https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119984
--- Comment #4 from saul.x.robinson at durham dot ac.uk ---
(In reply to saul.x.robinson from comment #0)
> I have confirmed is bug occurs on 15.1.0 and 12.2.0. Don't know how to find
> more recent versions.
> Those GCC versions were compiling for a 64bit linux distro.
> Also tested and saw the bug on a version of GCC15.1.0 compiled with
> --target=sh3eb-elf -disable-nls --without-headers .
> I filed it under tree-optimization as I do not know what field to put this
> under.
>
> On -O2 and above the second "and" statement seems to not be present in the
> machine code.
> //==the_Code==
> int test_func(long long temp){
> int ci,out;
> ci=temp;
> ci&=0x7f800000;
> ci+=127<<23;
> ci&=0x7f800000;
> out=ci;
> return out;
> }
> int main(){
> int out=test_func(-1);
> if (out&(1<<31)){return 1;}
> else{return 0;}
> }
I know the integer overflows.
Does that sort of undefined behavior cause issues with the final machine code
the compiler generates?