* [Bug c++/33025] Wrong optimisation
2007-08-08 17:46 [Bug c++/33025] New: Wrong optimisation theodore dot papadopoulo at sophia dot inria dot fr
@ 2007-08-08 17:49 ` theodore dot papadopoulo at sophia dot inria dot fr
2007-08-08 18:55 ` [Bug c++/33025] [4.3 Regression] Wrong calling of placement new with conditionals pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: theodore dot papadopoulo at sophia dot inria dot fr @ 2007-08-08 17:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from theodore dot papadopoulo at sophia dot inria dot fr 2007-08-08 17:49 -------
Created an attachment (id=14043)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14043&action=view)
The piece of code that shows the problem.
One more note. The bug seems related to the placement new syntax. Without
placement new, I do not have the same behaviour.
I'll try to update my gcc version tomorrow to recheck this on both
architectures.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33025
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/33025] [4.3 Regression] Wrong calling of placement new with conditionals
2007-08-08 17:46 [Bug c++/33025] New: Wrong optimisation theodore dot papadopoulo at sophia dot inria dot fr
2007-08-08 17:49 ` [Bug c++/33025] " theodore dot papadopoulo at sophia dot inria dot fr
@ 2007-08-08 18:55 ` pinskia at gcc dot gnu dot org
2007-08-09 9:18 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-08 18:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-08-08 18:55 -------
data[i] = (i%2==0) ? new(alloc.value()) unsigned(2) :
new(alloc()) unsigned(1);
D.2395 = value (&alloc);
D.2367 = D.2395;
D.2396 = operator() (&alloc);
unsigned int * D.2367;
<<cleanup_point <<< Unknown tree: expr_stmt
(void) (D.2367 = value (&alloc)) >>>
>>;
unsigned int * D.2384;
<<cleanup_point <<< Unknown tree: expr_stmt
(void) (D.2384 = operator() (&alloc)) >>>
>>;
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Keywords| |wrong-code
Summary|Wrong optimisation |[4.3 Regression] Wrong
| |calling of placement new
| |with conditionals
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33025
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/33025] [4.3 Regression] Wrong calling of placement new with conditionals
2007-08-08 17:46 [Bug c++/33025] New: Wrong optimisation theodore dot papadopoulo at sophia dot inria dot fr
2007-08-08 17:49 ` [Bug c++/33025] " theodore dot papadopoulo at sophia dot inria dot fr
2007-08-08 18:55 ` [Bug c++/33025] [4.3 Regression] Wrong calling of placement new with conditionals pinskia at gcc dot gnu dot org
@ 2007-08-09 9:18 ` pinskia at gcc dot gnu dot org
2007-08-09 12:03 ` theodore dot papadopoulo at sophia dot inria dot fr
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-09 9:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2007-08-09 09:18 -------
Because placement new is required to reproduce this bug and the front-end is
where the broken code happens already, then the patch to fix PR 29286 is the
cause.
The problem is in build_new_1 where we create a temp variable to hold the
placement variable is initialized with the value of the placement new which is
wrong as we don't get that initialization inside the conditional.
You can most likely reduce this testcase further using printf instead of cout
and saying if you call operator() too many times to abort.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ian at gcc dot gnu dot org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
GCC build triplet|x86_64-unknown-linux-gnu |
GCC host triplet|x86_64-unknown-linux-gnu |
GCC target triplet|x86_64-unknown-linux-gnu |
Last reconfirmed|0000-00-00 00:00:00 |2007-08-09 09:18:30
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33025
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/33025] [4.3 Regression] Wrong calling of placement new with conditionals
2007-08-08 17:46 [Bug c++/33025] New: Wrong optimisation theodore dot papadopoulo at sophia dot inria dot fr
` (2 preceding siblings ...)
2007-08-09 9:18 ` pinskia at gcc dot gnu dot org
@ 2007-08-09 12:03 ` theodore dot papadopoulo at sophia dot inria dot fr
2007-08-10 1:02 ` mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: theodore dot papadopoulo at sophia dot inria dot fr @ 2007-08-09 12:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from theodore dot papadopoulo at sophia dot inria dot fr 2007-08-09 12:02 -------
Created an attachment (id=14046)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14046&action=view)
A new more minimal test case
The same program was still working with gcc version 4.3.0 20070608
(experimental). This reduces slightly the bug introduction window even though
it looks that Andrew already spotted the exact patch that introduced the bug
(By the way thank's a lot!!).
grenade-> /usr/local/gcc-4.3/bin/g++ Bug.C
grenade-> /usr/local/gcc-4.3/bin/g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with:
/user/papadop/laptop/home/src/Cvs/Refs/gcc/gcc-svn-ref/trunk/configure
--prefix=/usr/local/gcc-4.3/ --enable-languages=c,c++,fortran
--enable-__cxa_atexit
Thread model: posix
gcc version 4.3.0 20070703 (experimental)
grenade-> ./a.out
Abort
grenade-> g++ Bug.C
grenade-> g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.1 20070105 (Red Hat 4.1.1-51)
grenade-> ./a.out
grenade-> /usr/local/gcc-4.3.old/bin/g++ Bug.C
grenade-> /usr/local/gcc-4.3.old/bin/g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with:
/user/papadop/laptop/home/src/Cvs/Refs/gcc/gcc-svn-ref/trunk/configure
--prefix=/usr/local/gcc-4.3/ --enable-languages=c,c++,fortran
--enable-__cxa_atexit
Thread model: posix
gcc version 4.3.0 20070608 (experimental)
grenade-> ./a.out
--
theodore dot papadopoulo at sophia dot inria dot fr changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #14043|0 |1
is obsolete| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33025
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/33025] [4.3 Regression] Wrong calling of placement new with conditionals
2007-08-08 17:46 [Bug c++/33025] New: Wrong optimisation theodore dot papadopoulo at sophia dot inria dot fr
` (3 preceding siblings ...)
2007-08-09 12:03 ` theodore dot papadopoulo at sophia dot inria dot fr
@ 2007-08-10 1:02 ` mmitchel at gcc dot gnu dot org
2007-08-16 16:03 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-08-10 1:02 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33025
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/33025] [4.3 Regression] Wrong calling of placement new with conditionals
2007-08-08 17:46 [Bug c++/33025] New: Wrong optimisation theodore dot papadopoulo at sophia dot inria dot fr
` (4 preceding siblings ...)
2007-08-10 1:02 ` mmitchel at gcc dot gnu dot org
@ 2007-08-16 16:03 ` jakub at gcc dot gnu dot org
2007-08-20 7:54 ` jakub at gcc dot gnu dot org
2007-08-20 8:19 ` jakub at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-08-16 16:03 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2007-08-09 09:18:30 |2007-08-16 16:02:42
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33025
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/33025] [4.3 Regression] Wrong calling of placement new with conditionals
2007-08-08 17:46 [Bug c++/33025] New: Wrong optimisation theodore dot papadopoulo at sophia dot inria dot fr
` (5 preceding siblings ...)
2007-08-16 16:03 ` jakub at gcc dot gnu dot org
@ 2007-08-20 7:54 ` jakub at gcc dot gnu dot org
2007-08-20 8:19 ` jakub at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-08-20 7:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jakub at gcc dot gnu dot org 2007-08-20 07:54 -------
Subject: Bug 33025
Author: jakub
Date: Mon Aug 20 07:53:58 2007
New Revision: 127639
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127639
Log:
PR c++/33025
* init.c (build_new_1): Rename placement_var variable to
placement_expr.
Initialize it with save_expr rather than get_temp_regvar.
* g++.dg/init/new23.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/init/new23.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/init.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33025
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/33025] [4.3 Regression] Wrong calling of placement new with conditionals
2007-08-08 17:46 [Bug c++/33025] New: Wrong optimisation theodore dot papadopoulo at sophia dot inria dot fr
` (6 preceding siblings ...)
2007-08-20 7:54 ` jakub at gcc dot gnu dot org
@ 2007-08-20 8:19 ` jakub at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-08-20 8:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jakub at gcc dot gnu dot org 2007-08-20 08:19 -------
Fixed.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33025
^ permalink raw reply [flat|nested] 9+ messages in thread