Hacker News new | past | comments | ask | show | jobs | submit login

MIPS has arithmetic instructions which trap on overflow. And guess what - gcc & clang use variants which DO NOT trap on overflow.

Why? If I had to guess, it's because there's more than a little C code out in the wild that relies on "typical" signed overflow behavior.

I don't know: both compilers are trying to use 'undefined use' to optimize code (and too bad for you if this create problems for your application), so your explanation isn't coherent.. My explanation is: lack of interest/money: security is the thing that is always ignored, see the lack of funding of OpenSSL until recently..

has or had? I think that some MIPS variant deprecated the trap on overflow, if this is the case then gcc & clang behaviour is logical if not then it's un-comprehensible (especially since at the same time they justify f.. up your executable for 'optimisation' purpose if you have an undefined in your code).

Forms with immediate operands were removed in MIPS Release 6, but the register-register forms are still there.

Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact