From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A844D3858015; Fri, 15 Oct 2021 09:47:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A844D3858015 From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102769] wrong code at -O1 and above on x86_64-linux-gnu Date: Fri, 15 Oct 2021 09:47:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin 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: bug_status resolution cc 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2021 09:47:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102769 Martin Li=C5=A1ka changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID CC| |marxin at gcc dot gnu.org --- Comment #1 from Martin Li=C5=A1ka --- I think it's invalid code: gcc-11 pr102769.c -g -fsanitize=3Daddress,undefined && ./a.out=20 =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=3D27019=3D=3DERROR: AddressSanitizer: stack-use-after-scope on address 0x7fffffffdd00 at pc 0x000000400bfd bp 0x7fffffffdcd0 sp 0x7fffffffdcc8 READ of size 4 at 0x7fffffffdd00 thread T0 #0 0x400bfc in main /home/marxin/Programming/testcases/pr102769.c:5 #1 0x7ffff6a7553f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 #2 0x7ffff6a755eb in __libc_start_main_impl ../csu/libc-start.c:409 #3 0x400a44 in _start (/home/marxin/Programming/testcases/a.out+0x400a4= 4) Address 0x7fffffffdd00 is located in stack of thread T0 at offset 32 in fra= me #0 0x400b15 in main /home/marxin/Programming/testcases/pr102769.c:2 This frame has 2 object(s): [32, 36) 'h' (line 7) <=3D=3D Memory access at offset 32 is inside this variable [48, 128) 'g' (line 3) 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-use-after-scope /home/marxin/Programming/testcases/pr102769.c:5 in main Shadow bytes around the buggy address: 0x10007fff7b50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7b60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7b70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7b90: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 =3D>0x10007fff7ba0:[f8]f2 00 00 00 00 00 00 00 00 00 00 f3 f3 f3 f3 0x10007fff7bb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7bc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7bd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7be0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7bf0: 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 Shadow gap: cc =3D=3D27019=3D=3DABORTING=