public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/14327] New: -O0 -fdefer-pop generates wrong code
@ 2004-02-27 23:59 jfran at clip dot dia dot fi dot upm dot es
  2004-02-28  0:06 ` [Bug target/14327] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jfran at clip dot dia dot fi dot upm dot es @ 2004-02-27 23:59 UTC (permalink / raw)
  To: gcc-bugs

The following program is not compiled correctly 
and produces a segmentation fault if compiled with
-O0 -fderef-pop. The code is compiled correctly
with -fno-defer-pop, or using a version =<3.2


// 

int code[]={0,0,0,0,1};

void foo(int x) {
  volatile int b;
  b = 0xffffffff;
}

void bar(int *pc) {
  static const void *l[] = {&&lab0, &&end};

  foo(0);
  goto *l[*pc];
 lab0:
  foo(0);
  pc++;
  goto *l[*pc];
 end:
  return;
}

int main() {
  bar(code);
  return 0;
}

-- 
           Summary: -O0 -fdefer-pop generates wrong code
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jfran at clip dot dia dot fi dot upm dot es
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug target/14327] [3.3/3.4/3.5 Regression] -O0 -fdefer-pop generates wrong code
  2004-02-27 23:59 [Bug c/14327] New: -O0 -fdefer-pop generates wrong code jfran at clip dot dia dot fi dot upm dot es
@ 2004-02-28  0:06 ` pinskia at gcc dot gnu dot org
  2004-02-28  1:28 ` jfran at clip dot dia dot fi dot upm dot es
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-28  0:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-28 00:06 -------
Confirmed a regression from 3.2.3.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |target
     Ever Confirmed|                            |1
 GCC target triplet|                            |i386-pc-linux-gnu
           Keywords|                            |wrong-code
      Known to fail|                            |3.3.1 3.4.0 3.5.0
      Known to work|                            |3.2.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-02-28 00:06:15
               date|                            |
            Summary|-O0 -fdefer-pop generates   |[3.3/3.4/3.5 Regression] -O0
                   |wrong code                  |-fdefer-pop generates wrong
                   |                            |code
   Target Milestone|---                         |3.3.4


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


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

* [Bug target/14327] [3.3/3.4/3.5 Regression] -O0 -fdefer-pop generates wrong code
  2004-02-27 23:59 [Bug c/14327] New: -O0 -fdefer-pop generates wrong code jfran at clip dot dia dot fi dot upm dot es
  2004-02-28  0:06 ` [Bug target/14327] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-02-28  1:28 ` jfran at clip dot dia dot fi dot upm dot es
  2004-03-02  9:53 ` steven at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jfran at clip dot dia dot fi dot upm dot es @ 2004-02-28  1:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jfran at clip dot dia dot fi dot upm dot es  2004-02-28 01:28 -------
Maybe that helps to solve the bug... the code seems to be correct if a 
dummy normal goto is placed before every the computed goto:

void bar(int *pc) {
  static const void *l[] = {&&lab0, &&end};
                                                                              
  foo(0);
  goto a0; a0: goto *l[*pc];
 lab0:
  foo(0);
  pc++;
  goto a1; a1: goto *l[*pc];
 end:
  return;
}



-- 


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


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

* [Bug target/14327] [3.3/3.4/3.5 Regression] -O0 -fdefer-pop generates wrong code
  2004-02-27 23:59 [Bug c/14327] New: -O0 -fdefer-pop generates wrong code jfran at clip dot dia dot fi dot upm dot es
  2004-02-28  0:06 ` [Bug target/14327] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-02-28  1:28 ` jfran at clip dot dia dot fi dot upm dot es
@ 2004-03-02  9:53 ` steven at gcc dot gnu dot org
  2004-03-02 23:51 ` rth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-03-02  9:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-03-02 09:53 -------
I'm trying to reghunt this one. 

-- 


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


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

* [Bug target/14327] [3.3/3.4/3.5 Regression] -O0 -fdefer-pop generates wrong code
  2004-02-27 23:59 [Bug c/14327] New: -O0 -fdefer-pop generates wrong code jfran at clip dot dia dot fi dot upm dot es
                   ` (2 preceding siblings ...)
  2004-03-02  9:53 ` steven at gcc dot gnu dot org
@ 2004-03-02 23:51 ` rth at gcc dot gnu dot org
  2004-03-03  0:18 ` [Bug middle-end/14327] " cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-03-02 23:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-03-02 23:51 -------
I know what the problem is...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug middle-end/14327] [3.3/3.4/3.5 Regression] -O0 -fdefer-pop generates wrong code
  2004-02-27 23:59 [Bug c/14327] New: -O0 -fdefer-pop generates wrong code jfran at clip dot dia dot fi dot upm dot es
                   ` (3 preceding siblings ...)
  2004-03-02 23:51 ` rth at gcc dot gnu dot org
@ 2004-03-03  0:18 ` cvs-commit at gcc dot gnu dot org
  2004-03-03  0:34 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-03  0:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-03 00:18 -------
Subject: Bug 14327

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2004-03-03 00:18:13

Modified files:
	gcc            : ChangeLog stmt.c 
Added files:
	gcc/testsuite/gcc.c-torture/execute: 20040302-1.c 

Log message:
	PR middle-end/14327
	* stmt.c (expand_computed_goto): Do do_pending_stack_adjust before
	emitting the label, not after.
	* gcc.c-torture/execute/20040302-1.c: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3007&r2=2.3008
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&r1=1.347&r2=1.348
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20040302-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug middle-end/14327] [3.3/3.4/3.5 Regression] -O0 -fdefer-pop generates wrong code
  2004-02-27 23:59 [Bug c/14327] New: -O0 -fdefer-pop generates wrong code jfran at clip dot dia dot fi dot upm dot es
                   ` (4 preceding siblings ...)
  2004-03-03  0:18 ` [Bug middle-end/14327] " cvs-commit at gcc dot gnu dot org
@ 2004-03-03  0:34 ` cvs-commit at gcc dot gnu dot org
  2004-03-03  0:39 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-03  0:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-03 00:34 -------
Subject: Bug 14327

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	rth@gcc.gnu.org	2004-03-03 00:34:49

Modified files:
	gcc            : ChangeLog stmt.c 
Added files:
	gcc/testsuite/gcc.c-torture/execute: 20040302-1.c 

Log message:
	PR middle-end/14327
	* stmt.c (expand_computed_goto): Do do_pending_stack_adjust before
	emitting the label, not after.

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.916&r2=1.16114.2.917
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.276.2.13&r2=1.276.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20040302-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug middle-end/14327] [3.3/3.4/3.5 Regression] -O0 -fdefer-pop generates wrong code
  2004-02-27 23:59 [Bug c/14327] New: -O0 -fdefer-pop generates wrong code jfran at clip dot dia dot fi dot upm dot es
                   ` (5 preceding siblings ...)
  2004-03-03  0:34 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-03  0:39 ` cvs-commit at gcc dot gnu dot org
  2004-03-03  0:53 ` rth at gcc dot gnu dot org
  2004-03-04  7:50 ` cvs-commit at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-03  0:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-03 00:39 -------
Subject: Bug 14327

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	rth@gcc.gnu.org	2004-03-03 00:39:27

Modified files:
	gcc            : ChangeLog stmt.c 
Added files:
	gcc/testsuite/gcc.c-torture/execute: 20040302-1.c 

Log message:
	PR middle-end/14327
	* stmt.c (expand_computed_goto): Do do_pending_stack_adjust before
	emitting the label, not after.
	* gcc.c-torture/execute/20040302-1.c: New.

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.279&r2=2.2326.2.280
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.342.2.1&r2=1.342.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20040302-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.4.1



-- 


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


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

* [Bug middle-end/14327] [3.3/3.4/3.5 Regression] -O0 -fdefer-pop generates wrong code
  2004-02-27 23:59 [Bug c/14327] New: -O0 -fdefer-pop generates wrong code jfran at clip dot dia dot fi dot upm dot es
                   ` (6 preceding siblings ...)
  2004-03-03  0:39 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-03  0:53 ` rth at gcc dot gnu dot org
  2004-03-04  7:50 ` cvs-commit at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2004-03-03  0:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2004-03-03 00:53 -------
http://gcc.gnu.org/ml/gcc-patches/2004-03/msg00227.html

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


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


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

* [Bug middle-end/14327] [3.3/3.4/3.5 Regression] -O0 -fdefer-pop generates wrong code
  2004-02-27 23:59 [Bug c/14327] New: -O0 -fdefer-pop generates wrong code jfran at clip dot dia dot fi dot upm dot es
                   ` (7 preceding siblings ...)
  2004-03-03  0:53 ` rth at gcc dot gnu dot org
@ 2004-03-04  7:50 ` cvs-commit at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-04  7:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-04 07:49 -------
Subject: Bug 14327

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	hammer-3_3-branch
Changes by:	steven@gcc.gnu.org	2004-03-04 07:49:47

Modified files:
	gcc            : ChangeLog.hammer optabs.c stmt.c 
	gcc/testsuite  : ChangeLog.hammer 
Added files:
	gcc/testsuite/g++.dg/other: profile1.C 
	gcc/testsuite/gcc.c-torture/execute: 20040302-1.c 

Log message:
	PR middle-end/11767
	* optabs.c (prepare_cmp_insn): Force trapping memories to registers
	before the compare, if flag_non_call_exceptions.
	
	PR middle-end/14327
	* stmt.c (expand_computed_goto): Do do_pending_stack_adjust before
	emitting the label, not after.
	
	testsuite/
	* g++.dg/other/profile1.C: New test for PR11767.
	* gcc.c-torture/execute/20040302-1.c: New test for PR14327.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.hammer.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.1.2.351&r2=1.1.2.352
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/optabs.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.150.2.10&r2=1.150.2.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.273.2.13&r2=1.273.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.hammer.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.1.2.13&r2=1.1.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/profile1.C.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.2.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20040302-1.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=NONE&r2=1.1.8.1



-- 


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


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

end of thread, other threads:[~2004-03-04  7:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-27 23:59 [Bug c/14327] New: -O0 -fdefer-pop generates wrong code jfran at clip dot dia dot fi dot upm dot es
2004-02-28  0:06 ` [Bug target/14327] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-02-28  1:28 ` jfran at clip dot dia dot fi dot upm dot es
2004-03-02  9:53 ` steven at gcc dot gnu dot org
2004-03-02 23:51 ` rth at gcc dot gnu dot org
2004-03-03  0:18 ` [Bug middle-end/14327] " cvs-commit at gcc dot gnu dot org
2004-03-03  0:34 ` cvs-commit at gcc dot gnu dot org
2004-03-03  0:39 ` cvs-commit at gcc dot gnu dot org
2004-03-03  0:53 ` rth at gcc dot gnu dot org
2004-03-04  7:50 ` cvs-commit 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).