public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/17661] New: ICE in create_tmp_var
@ 2004-09-24 17:13 jakub at gcc dot gnu dot org
  2004-09-24 17:14 ` [Bug tree-optimization/17661] " arjanv at redhat dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2004-09-24 17:13 UTC (permalink / raw)
  To: gcc-bugs

struct C
{
  int *c;
  C () : c (0) { }
  C (const C &x) : c (x.c) { }
  C &operator++ () { return *this; }
};

int
foo (void)
{
  int i = 0;
  C j;
  bool k = false;

  for (; i < 30; k ? j : ++j)
    k = false, ++i;

  return 0;
}

ICEs at any optimization level in create_tmp_var.
Works ok in G++ 3.4.2.

-- 
           Summary: ICE in create_tmp_var
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: x86_64-redhat-linux


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


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

* [Bug tree-optimization/17661] ICE in create_tmp_var
  2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
@ 2004-09-24 17:14 ` arjanv at redhat dot com
  2004-09-24 17:33 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: arjanv at redhat dot com @ 2004-09-24 17:14 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arjanv at redhat dot com


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


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

* [Bug tree-optimization/17661] ICE in create_tmp_var
  2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
  2004-09-24 17:14 ` [Bug tree-optimization/17661] " arjanv at redhat dot com
@ 2004-09-24 17:33 ` pinskia at gcc dot gnu dot org
  2004-10-12 15:42 ` mueller at kde dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-24 17:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-24 17:33 -------


*** This bug has been marked as a duplicate of 17554 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

* [Bug tree-optimization/17661] ICE in create_tmp_var
  2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-10-12 15:42 ` mueller at kde dot org
@ 2004-10-12 15:42 ` mueller at kde dot org
  2004-10-12 16:00 ` [Bug tree-optimization/17661] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mueller at kde dot org @ 2004-10-12 15:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mueller at kde dot org  2004-10-12 15:42 -------
reduced testcase:  
 
struct C 
{ 
  int *c; 
  C () : c (0) { } 
  C (const C &x) : c (x.c) { } 
  C &operator++ () { return *this; } 
}; 
 
void breakme (void) 
{ 
  C j; 
  bool k = false; 
 
  for (;; k ? j : ++j) 
    ; 
} 
 

-- 


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


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

* [Bug tree-optimization/17661] ICE in create_tmp_var
  2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
  2004-09-24 17:14 ` [Bug tree-optimization/17661] " arjanv at redhat dot com
  2004-09-24 17:33 ` pinskia at gcc dot gnu dot org
@ 2004-10-12 15:42 ` mueller at kde dot org
  2004-10-12 15:42 ` mueller at kde dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mueller at kde dot org @ 2004-10-12 15:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mueller at kde dot org  2004-10-12 15:41 -------
Please reopen this bugreport, its not a duplicate of 17554 and  
still unfixed (while 17554 is fixed). 
 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


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


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

* [Bug tree-optimization/17661] [4.0 Regression] ICE in create_tmp_var
  2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-10-12 15:42 ` mueller at kde dot org
@ 2004-10-12 16:00 ` pinskia at gcc dot gnu dot org
  2004-10-12 16:04 ` [Bug c++/17661] " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-12 16:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-12 16:00 -------
Hmm, i will look into it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
           Keywords|                            |ice-on-valid-code
         Resolution|DUPLICATE                   |
            Summary|ICE in create_tmp_var       |[4.0 Regression] ICE in
                   |                            |create_tmp_var
   Target Milestone|---                         |4.0.0


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


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

* [Bug c++/17661] [4.0 Regression] ICE in create_tmp_var
  2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-10-12 16:00 ` [Bug tree-optimization/17661] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-10-12 16:04 ` pinskia at gcc dot gnu dot org
  2004-10-12 16:06 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-12 16:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-12 16:04 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|tree-optimization           |c++
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-12 16:04:36
               date|                            |


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


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

* [Bug c++/17661] [4.0 Regression] ICE in create_tmp_var
  2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-10-12 16:04 ` [Bug c++/17661] " pinskia at gcc dot gnu dot org
@ 2004-10-12 16:06 ` pinskia at gcc dot gnu dot org
  2004-10-12 16:23 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-12 16:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-12 16:06 -------
Actually here is the reduced testcase:
struct C
{
  C (const C &x);
};
C &f();
void breakme (C j, bool k)
{
  for (;; k ? j : f())  ;
}

-- 


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


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

* [Bug c++/17661] [4.0 Regression] ICE in create_tmp_var
  2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-10-12 16:06 ` pinskia at gcc dot gnu dot org
@ 2004-10-12 16:23 ` pinskia at gcc dot gnu dot org
  2004-10-12 17:21 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-12 16:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-12 16:23 -------
This patch fixes it, I will submit it soon:
Index: semantics.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.446
diff -u -p -r1.446 semantics.c
--- semantics.c	11 Oct 2004 11:47:11 -0000	1.446
+++ semantics.c	12 Oct 2004 16:23:00 -0000
@@ -798,6 +798,14 @@ finish_for_expr (tree expr, tree for_stm
       cxx_incomplete_type_error (expr, TREE_TYPE (expr));
       expr = error_mark_node;
     }
+  if (!processing_template_decl)
+    {
+      if (warn_sequence_point)
+        verify_sequence_points (expr);
+      expr = convert_to_void (expr, "3rd expression in for");
+    }
+  else if (!type_dependent_expression_p (expr))
+    convert_to_void (build_non_dependent_expr (expr), "3rd expression in for");
   expr = maybe_cleanup_point_expr_void (expr);
   FOR_EXPR (for_stmt) = expr;
 }


-- 


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


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

* [Bug c++/17661] [4.0 Regression] ICE in create_tmp_var
  2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2004-10-12 16:23 ` pinskia at gcc dot gnu dot org
@ 2004-10-12 17:21 ` pinskia at gcc dot gnu dot org
  2004-10-13 17:18 ` cvs-commit at gcc dot gnu dot org
  2004-10-13 17:18 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-12 17:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-12 17:16 -------
I send out the email for the patch but it looks like the web archiver is not working.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
           Keywords|                            |patch


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


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

* [Bug c++/17661] [4.0 Regression] ICE in create_tmp_var
  2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2004-10-13 17:18 ` cvs-commit at gcc dot gnu dot org
@ 2004-10-13 17:18 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-13 17:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-13 17:18 -------
Fixed.

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


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


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

* [Bug c++/17661] [4.0 Regression] ICE in create_tmp_var
  2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2004-10-12 17:21 ` pinskia at gcc dot gnu dot org
@ 2004-10-13 17:18 ` cvs-commit at gcc dot gnu dot org
  2004-10-13 17:18 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-13 17:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-13 17:18 -------
Subject: Bug 17661

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2004-10-13 17:18:16

Modified files:
	gcc/cp         : ChangeLog semantics.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/expr: for2.C 

Log message:
	2004-10-13  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR c++/17661
	* testsuite/g++.dg/expr/for2.C: New test.
	
	2004-10-13  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR c++/17661
	* semantics.c (finish_for_expr): Convert expression to void
	so that we don't create temporaries for a?b:c.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4431&r2=1.4432
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.446&r2=1.447
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4442&r2=1.4443
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/for2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

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

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-24 17:13 [Bug tree-optimization/17661] New: ICE in create_tmp_var jakub at gcc dot gnu dot org
2004-09-24 17:14 ` [Bug tree-optimization/17661] " arjanv at redhat dot com
2004-09-24 17:33 ` pinskia at gcc dot gnu dot org
2004-10-12 15:42 ` mueller at kde dot org
2004-10-12 15:42 ` mueller at kde dot org
2004-10-12 16:00 ` [Bug tree-optimization/17661] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-10-12 16:04 ` [Bug c++/17661] " pinskia at gcc dot gnu dot org
2004-10-12 16:06 ` pinskia at gcc dot gnu dot org
2004-10-12 16:23 ` pinskia at gcc dot gnu dot org
2004-10-12 17:21 ` pinskia at gcc dot gnu dot org
2004-10-13 17:18 ` cvs-commit at gcc dot gnu dot org
2004-10-13 17:18 ` pinskia 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).