public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/63360] New: Does not retore f31 at -O0 across function calls
@ 2014-09-24 18:56 camm at debian dot org
  2014-09-24 22:18 ` [Bug target/63360] " bergner at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-24 18:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

            Bug ID: 63360
           Summary: Does not retore f31 at -O0 across function calls
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: camm at debian dot org

Created attachment 33551
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33551&action=edit
invert.c, invert.cpp, and invert.gdb gdb session

Register variable stored in f31 is stored on the stack, but not restored and
thus clobbered, after a function call.

Compiled with 

gcc -c -g  -Wall -fsigned-char -Wno-unused-but-set-variable -pipe -g -mlongcall


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
@ 2014-09-24 22:18 ` bergner at gcc dot gnu.org
  2014-09-25 14:47 ` camm at debian dot org
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bergner at gcc dot gnu.org @ 2014-09-24 22:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #1 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to camm from comment #0)
> Created attachment 33551 [details]
> invert.c, invert.cpp, and invert.gdb gdb session
> 
> Register variable stored in f31 is stored on the stack, but not restored and
> thus clobbered, after a function call.

Camm and I  discussed this offline and I mentioned that the gdb disassembly
doesn't show any of the functions called by L2(), so we cannot determine which
function is clobbering f31.  Camm is going to rerun the debugger and determine
which calle is clobbering f31 and get the disassemb;y for that.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
  2014-09-24 22:18 ` [Bug target/63360] " bergner at gcc dot gnu.org
@ 2014-09-25 14:47 ` camm at debian dot org
  2014-09-25 14:59 ` camm at debian dot org
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-25 14:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #2 from camm at debian dot org ---
Created attachment 33563
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33563&action=edit
gdb transcript showing longjmp clobbering of f31


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
  2014-09-24 22:18 ` [Bug target/63360] " bergner at gcc dot gnu.org
  2014-09-25 14:47 ` camm at debian dot org
@ 2014-09-25 14:59 ` camm at debian dot org
  2014-09-25 15:00 ` camm at debian dot org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-25 14:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #3 from camm at debian dot org ---
Additional transcript showing the 0 f31 value is transmitted to the return of
the original call through Lnk23 in L2.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (2 preceding siblings ...)
  2014-09-25 14:59 ` camm at debian dot org
@ 2014-09-25 15:00 ` camm at debian dot org
  2014-09-25 15:05 ` schwab@linux-m68k.org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-25 15:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #4 from camm at debian dot org ---
Created attachment 33564
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33564&action=edit
additional gdb transcript showing 0 f31 transmitted to return of Lnk23 in L2


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (3 preceding siblings ...)
  2014-09-25 15:00 ` camm at debian dot org
@ 2014-09-25 15:05 ` schwab@linux-m68k.org
  2014-09-25 16:16 ` camm at debian dot org
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: schwab@linux-m68k.org @ 2014-09-25 15:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #5 from Andreas Schwab <schwab@linux-m68k.org> ---
Please make sure all functions are called exactly as they are defined.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (4 preceding siblings ...)
  2014-09-25 15:05 ` schwab@linux-m68k.org
@ 2014-09-25 16:16 ` camm at debian dot org
  2014-09-25 16:17 ` camm at debian dot org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-25 16:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #6 from camm at debian dot org ---
Here is another transcript showing the innermost setjmp/longjmp pair corrupting
the f31 register.  It is a little complicated as there is an inner call to the
same code which proceeds successfully.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (5 preceding siblings ...)
  2014-09-25 16:16 ` camm at debian dot org
@ 2014-09-25 16:17 ` camm at debian dot org
  2014-09-25 17:10 ` bergner at gcc dot gnu.org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-25 16:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #7 from camm at debian dot org ---
Created attachment 33567
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33567&action=edit
gdb transcript showing innermost setjmp/longjmp f31 clobber


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (6 preceding siblings ...)
  2014-09-25 16:17 ` camm at debian dot org
@ 2014-09-25 17:10 ` bergner at gcc dot gnu.org
  2014-09-25 17:26 ` camm at debian dot org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bergner at gcc dot gnu.org @ 2014-09-25 17:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #8 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to camm from comment #6)
> Here is another transcript showing the innermost setjmp/longjmp pair
> corrupting the f31 register.

I've looked at the longjmp code and it seems fine to me.  Since you said
offline that your code works correctly when compiled with optimization and
fails without optimization, that too would clear setjmp/longjmp from being the
guilty party, since both runs are using the same setjmp/longjmp glibc library
code.

That said, if longjmp() is indeed returning a clobbered value for f31, then it
is my guess that the jmpbuf being passed to longjmp is being clobbered
somewhere between the setjmp call and the longjmp call.  Can you set a watch
point on the jmpbuf and try and track down where it is being clobbered?


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (7 preceding siblings ...)
  2014-09-25 17:10 ` bergner at gcc dot gnu.org
@ 2014-09-25 17:26 ` camm at debian dot org
  2014-09-25 19:02 ` bergner at gcc dot gnu.org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-25 17:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #9 from camm at debian dot org ---
Created attachment 33570
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33570&action=edit
the setjmp buffer does not appear to be clobbered


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (8 preceding siblings ...)
  2014-09-25 17:26 ` camm at debian dot org
@ 2014-09-25 19:02 ` bergner at gcc dot gnu.org
  2014-09-25 19:24 ` camm at debian dot org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: bergner at gcc dot gnu.org @ 2014-09-25 19:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

Peter Bergner <bergner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uweigand at gcc dot gnu.org

--- Comment #10 from Peter Bergner <bergner at gcc dot gnu.org> ---
Adding Uli to the bugzilla, since he implemented all of the ELFv2 ABI call
changes.

Uli, any ideas on what might be going on here?  It looks to me, that ELFv1 and
ELFv2 use the same exact jmpbuf layout and setjmp/longjmp code, so that looks
to be correct and not buggy.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (9 preceding siblings ...)
  2014-09-25 19:02 ` bergner at gcc dot gnu.org
@ 2014-09-25 19:24 ` camm at debian dot org
  2014-09-25 19:36 ` camm at debian dot org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-25 19:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #11 from camm at debian dot org ---
Created attachment 33571
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33571&action=edit
gdb transcript showing jmp_buf is unchanged across setjmp && longjmp


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (10 preceding siblings ...)
  2014-09-25 19:24 ` camm at debian dot org
@ 2014-09-25 19:36 ` camm at debian dot org
  2014-09-25 19:47 ` camm at debian dot org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-25 19:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #12 from camm at debian dot org ---
Created attachment 33572
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33572&action=edit
setjmp does write to jmp_buf, but not at the end of the buffer.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (11 preceding siblings ...)
  2014-09-25 19:36 ` camm at debian dot org
@ 2014-09-25 19:47 ` camm at debian dot org
  2014-09-25 19:52 ` camm at debian dot org
  2014-09-25 20:12 ` camm at debian dot org
  14 siblings, 0 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-25 19:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #13 from camm at debian dot org ---
Created attachment 33573
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33573&action=edit
gdb transcript shoinwg f31 is correct on entry to setjmp


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (12 preceding siblings ...)
  2014-09-25 19:47 ` camm at debian dot org
@ 2014-09-25 19:52 ` camm at debian dot org
  2014-09-25 20:12 ` camm at debian dot org
  14 siblings, 0 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-25 19:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #14 from camm at debian dot org ---
Created attachment 33574
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33574&action=edit
continuation of gdb.7 showing no stfd fp31,((39)*8)(3) executed


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/63360] Does not retore f31 at -O0 across function calls
  2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
                   ` (13 preceding siblings ...)
  2014-09-25 19:52 ` camm at debian dot org
@ 2014-09-25 20:12 ` camm at debian dot org
  14 siblings, 0 replies; 16+ messages in thread
From: camm at debian dot org @ 2014-09-25 20:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63360

--- Comment #15 from camm at debian dot org ---
Created attachment 33575
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33575&action=edit
setjmp saves f31, then zeroes out the result with stvx    v3,0,r5


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-09-25 20:12 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-24 18:56 [Bug target/63360] New: Does not retore f31 at -O0 across function calls camm at debian dot org
2014-09-24 22:18 ` [Bug target/63360] " bergner at gcc dot gnu.org
2014-09-25 14:47 ` camm at debian dot org
2014-09-25 14:59 ` camm at debian dot org
2014-09-25 15:00 ` camm at debian dot org
2014-09-25 15:05 ` schwab@linux-m68k.org
2014-09-25 16:16 ` camm at debian dot org
2014-09-25 16:17 ` camm at debian dot org
2014-09-25 17:10 ` bergner at gcc dot gnu.org
2014-09-25 17:26 ` camm at debian dot org
2014-09-25 19:02 ` bergner at gcc dot gnu.org
2014-09-25 19:24 ` camm at debian dot org
2014-09-25 19:36 ` camm at debian dot org
2014-09-25 19:47 ` camm at debian dot org
2014-09-25 19:52 ` camm at debian dot org
2014-09-25 20:12 ` camm at debian dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).