From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CA8983882059; Thu, 13 Jun 2024 15:41:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA8983882059 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718293263; bh=NI3YNO9Pp1pfHp5slqPR44CoQKwUgCNkRXFxZqdOW3o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WcZD5CKmD+jdWRrVAzRm7G5WkxS+5QlIxCkPSqUQe+nyTTBVaXlmkTSsAYPELFh0P mULImRfT/pq8Eh3xIg/zQ8rAs9cbz9EFTZPXzUBEZ2rBwOSCAaCB0JHHBAbxVcAjcN 7OfEge2chYuwW8zCjaXB7b9HR+ld1GQNfS7YYhgU= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/115477] compiling with gcc flips the sign of a float return value Date: Thu, 13 Jun 2024 15:41:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115477 --- Comment #2 from Andrew Pinski --- Note with -fsanitize=3Daddress we get errors as one would expect: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D1=3D=3DERROR: AddressSanitizer: stack-buffer-overflow on address 0x7d= c0b8500030 at pc 0x0000004012de bp 0x7ffdaad9b020 sp 0x7ffdaad9b018 READ of size 8 at 0x7dc0b8500030 thread T0 #0 0x4012dd in bug(float) (/app/output.s+0x4012dd) (BuildId: a1b2ef91caf86d8cdb54f9543157d73b050c2ddf) #1 0x401456 in main (/app/output.s+0x401456) (BuildId: a1b2ef91caf86d8cdb54f9543157d73b050c2ddf) #2 0x7dc0ba229d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: 962015aa9d133c6cbcfb31ec300596d7f44d3348) #3 0x7dc0ba229e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: 962015aa9d133c6cbcfb31ec300596d7f44d3348) #4 0x401114 in _start (/app/output.s+0x401114) (BuildId: a1b2ef91caf86d8cdb54f9543157d73b050c2ddf) Address 0x7dc0b8500030 is located in stack of thread T0 at offset 48 in fra= me #0 0x4011e5 in bug(float) (/app/output.s+0x4011e5) (BuildId: a1b2ef91caf86d8cdb54f9543157d73b050c2ddf) This frame has 2 object(s): [48, 52) 'y' (line 5) <=3D=3D Memory access at offset 48 partially over= flows this variable [64, 72) 'i' (line 4) HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow (/app/output.s+0x4012dd) (BuildId: a1b2ef91caf86d8cdb54f9543157d73b050c2ddf) in bug(float) Shadow bytes around the buggy address: 0x7dc0b84ffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7dc0b84ffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7dc0b84ffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7dc0b84fff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7dc0b84fff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =3D>0x7dc0b8500000: f1 f1 f1 f1 f1 f1[04]f2 00 f3 f3 f3 00 00 00 00 0x7dc0b8500080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7dc0b8500100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7dc0b8500180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7dc0b8500200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7dc0b8500280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07=20 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb =3D=3D1=3D=3DABORTING=