public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14381] New: [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue
@ 2004-03-02 10:23 aph at gcc dot gnu dot org
  2004-03-02 15:22 ` [Bug optimization/14381] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: aph at gcc dot gnu dot org @ 2004-03-02 10:23 UTC (permalink / raw)
  To: gcc-bugs

g++ is compiling

------------------------------------------------------------------------
typedef struct kkclass;
typedef struct kkclass *jclass;

struct _Jv_VTable
{
  jclass clas;
};

jclass
getClass (void *p)
{
  _Jv_VTable **dt = (_Jv_VTable **) p;
  return (*dt)->clas;
}
------------------------------------------------------------------------

into 

_Z8getClassPv:
.LFB2:
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
        movl    8(%ebp), %edx
        popl    %ebp
        movl    (%edx), %eax
        movl    (%eax), %eax
        ret
.LFE2:

where, as you can see, the code for the memory access is moved after
the stack adjustment in the epilogue.

This is despite the fact that this code was compiled with
-fnon-call-exceptions and -fno-omit-frame-pointer.

This causes a runtime failure to catch a null pointer exception.
Insns that may trap must not be move into the epilogue, because stack
unwinding when throwing exceptions will not work correctly.

g++ 3.2.2 does this, which is correct:

_Z8getClassPv:
.LFB2:
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
        movl    8(%ebp), %eax
        movl    (%eax), %eax
        movl    (%eax), %eax
        leave
        ret
.LFE2:

The movement of the popl %ebp instruction seems to be in sched2.

Compiler options used were -O3 -fno-omit-frame-pointer -fnon-call-exceptions.

-- 
           Summary: [3.3/3.4/3.5 Regression] sched2 moving "may throw"
                    instructions into epilogue
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aph at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14381


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

* [Bug optimization/14381] [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue
  2004-03-02 10:23 [Bug optimization/14381] New: [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue aph at gcc dot gnu dot org
@ 2004-03-02 15:22 ` pinskia at gcc dot gnu dot org
  2004-03-06 11:20 ` ebotcazou at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-02 15:22 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
           Keywords|                            |wrong-code
   Target Milestone|---                         |3.3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14381


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

* [Bug optimization/14381] [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue
  2004-03-02 10:23 [Bug optimization/14381] New: [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue aph at gcc dot gnu dot org
  2004-03-02 15:22 ` [Bug optimization/14381] " pinskia at gcc dot gnu dot org
@ 2004-03-06 11:20 ` ebotcazou at gcc dot gnu dot org
  2004-03-10 17:19 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2004-03-06 11:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2004-03-06 11:20 -------
Andrew, please assign the PR to you when you're working on the problem.  Thanks.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |aph at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14381


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

* [Bug optimization/14381] [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue
  2004-03-02 10:23 [Bug optimization/14381] New: [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue aph at gcc dot gnu dot org
  2004-03-02 15:22 ` [Bug optimization/14381] " pinskia at gcc dot gnu dot org
  2004-03-06 11:20 ` ebotcazou at gcc dot gnu dot org
@ 2004-03-10 17:19 ` cvs-commit at gcc dot gnu dot org
  2004-03-10 17:27 ` aph at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-10 17:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-10 17:19 -------
Subject: Bug 14381

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	aph@gcc.gnu.org	2004-03-10 17:19:25

Modified files:
	gcc            : ChangeLog function.c 

Log message:
	2004-03-10  Andrew Haley  <aph@redhat.com>
	
	PR optimization/14381
	* function.c (expand_function_end): Emit a blockage insn before
	the epilogue when -fnon-call-exceptions is used.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.325&r2=2.2326.2.326
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.483.4.8&r2=1.483.4.9



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14381


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

* [Bug optimization/14381] [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue
  2004-03-02 10:23 [Bug optimization/14381] New: [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue aph at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-03-10 17:19 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-10 17:27 ` aph at gcc dot gnu dot org
  2004-03-10 17:42 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: aph at gcc dot gnu dot org @ 2004-03-10 17:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From aph at gcc dot gnu dot org  2004-03-10 17:27 -------
I'm not sure this one is fixed: the right thing to do is either to prevent sched
from moving trapping insns into epilogues or to generate unwind info for them.

My kludge does not a fix make...


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14381


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

* [Bug optimization/14381] [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue
  2004-03-02 10:23 [Bug optimization/14381] New: [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue aph at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-03-10 17:27 ` aph at gcc dot gnu dot org
@ 2004-03-10 17:42 ` cvs-commit at gcc dot gnu dot org
  2004-03-10 17:58 ` cvs-commit at gcc dot gnu dot org
  2004-03-10 17:59 ` aph at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-10 17:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-10 17:42 -------
Subject: Bug 14381

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	aph@gcc.gnu.org	2004-03-10 17:42:21

Modified files:
	gcc            : ChangeLog function.c 

Log message:
	2004-03-10  Andrew Haley  <aph@redhat.com>
	
	PR optimization/14381
	* function.c (expand_function_end): Emit a blockage insn before
	the epilogue when -fnon-call-exceptions is used.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.928&r2=1.16114.2.929
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.389.2.13&r2=1.389.2.14



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14381


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

* [Bug optimization/14381] [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue
  2004-03-02 10:23 [Bug optimization/14381] New: [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue aph at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-03-10 17:42 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-10 17:58 ` cvs-commit at gcc dot gnu dot org
  2004-03-10 17:59 ` aph at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-10 17:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-10 17:58 -------
Subject: Bug 14381

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aph@gcc.gnu.org	2004-03-10 17:58:32

Modified files:
	gcc            : ChangeLog 

Log message:
	2004-03-10  Andrew Haley  <aph@redhat.com>
	
	PR optimization/14381
	* function.c (expand_function_end): Emit a blockage insn before
	the epilogue when -fnon-call-exceptions is used.
	
	* except.c (expand_start_all_catch): Make comment more accurate.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3117&r2=2.3118



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14381


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

* [Bug optimization/14381] [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue
  2004-03-02 10:23 [Bug optimization/14381] New: [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue aph at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-03-10 17:58 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-10 17:59 ` aph at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: aph at gcc dot gnu dot org @ 2004-03-10 17:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From aph at gcc dot gnu dot org  2004-03-10 17:59 -------
	* function.c (expand_function_end): Emit a blockage insn before
	the epilogue when -fnon-call-exceptions is used.
	

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14381


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

end of thread, other threads:[~2004-03-10 17:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-02 10:23 [Bug optimization/14381] New: [3.3/3.4/3.5 Regression] sched2 moving "may throw" instructions into epilogue aph at gcc dot gnu dot org
2004-03-02 15:22 ` [Bug optimization/14381] " pinskia at gcc dot gnu dot org
2004-03-06 11:20 ` ebotcazou at gcc dot gnu dot org
2004-03-10 17:19 ` cvs-commit at gcc dot gnu dot org
2004-03-10 17:27 ` aph at gcc dot gnu dot org
2004-03-10 17:42 ` cvs-commit at gcc dot gnu dot org
2004-03-10 17:58 ` cvs-commit at gcc dot gnu dot org
2004-03-10 17:59 ` aph at gcc dot gnu 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).