From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 62EE738582A0; Tue, 27 Feb 2024 13:38:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62EE738582A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709041138; bh=gF73KmexDyoWgit/pmTN2ppUdBZ5IDm+7J5dkA3Dj40=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oPIGoYmWv0sFCGotpbTkvbf1XZtAIwjlbc8roIFCfhoto/Q/VxiSlkNG9B0NKvobM MVPb03AcKIWI2+VpOXXfHTLJnovJIuV/i1cDNo6Mt9UvrvdsCxK3fER6n+YUo6RBJ/ GCEywm7aiWj7zr2AJt8clASdjtwhL2aU9CpJFMEI= From: "lukas.graetz@tu-darmstadt.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/38534] gcc 4.2.1 and above: No need to save called-saved registers in 'noreturn' function Date: Tue, 27 Feb 2024 13:38:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 4.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lukas.graetz@tu-darmstadt.de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: 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=3D38534 --- Comment #33 from Lukas Gr=C3=A4tz --- (In reply to Jakub Jelinek from comment #32) > (In reply to Lukas Gr=C3=A4tz from comment #31) > > Even when I compile a simple program with gcc -O2 -g: > >=20 > > #include > > int main(int argc, char** argv) { > > abort(); > > } > >=20 > >=20 > > I still get an "argc=3D": >=20 > Sure, debugging info in optimized code is best effort. >=20 > > Yes, for a better debugging, it would be nice if optimised code would j= ust > > not be optimised... But this goes against optimization. >=20 > The significant difference between other optimizations and this one is > that normal optimizations affect the debuggability of the optimized funct= ion. > This one affects the debuggability of all callers as well, even if they a= re > compiled in a way that should make them more debuggable. > Normally, if debugging optimized code doesn't work out, one can simply > rebuild that code with -O0 or -Og to make it more debuggable. > Here one would also need to rebuild all the shared libraries it uses. When the debugger is inside the debuggable -O0 or -Og compiled function, we would see all parameters and current variable values. However, in the bt example, we are in another function. So the parameters are only available at best effort. I just noticed that for my simple.c example above, I get "argc=3D" even with -Og. However, when breakpoint is somewhere else, (gdb) break main (gdb) run (gdb) bt I get the correct "argc=3D1". The same applies to your example with "break = baz". It is just not guaranteed that gdb is able to reconstruct function paramete= rs when we are in some other function.=