public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/22098] New: [4.0/4.1 Regression] ICE in compound literal gimplification
@ 2005-06-16 21:33 jsm28 at gcc dot gnu dot org
  2005-06-16 21:36 ` [Bug c/22098] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-06-16 21:33 UTC (permalink / raw)
  To: gcc-bugs

extern void abort (void);
extern void exit (int);
typedef __SIZE_TYPE__ size_t;
int
main (void)
{
  int a = 0;
  int *p;
  size_t b;
  b = (size_t)(p = &(int []){0, 1, 2}[1]);
  if (*p != 1 || *(int *)b != 1)
    abort ();
  exit (0);
}

ICEs on mainline and 4.0 branch but not 3.4.4.  The problem is the compound
literal address is considered TREE_CONSTANT which allows it to be duplicated by
fold, but gimplifying the same compound literal more than once yields an ICE.

I'll suggest an approach for a fix in a followup to
<http://gcc.gnu.org/ml/gcc-patches/2005-06/msg01448.html>.

t.c: In function 'main':
t.c:10: internal compiler error: in gimple_add_tmp_var, at gimplify.c:532
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

-- 
           Summary: [4.0/4.1 Regression] ICE in compound literal
                    gimplification
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsm28 at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c/22098] [4.0/4.1 Regression] ICE in compound literal gimplification
  2005-06-16 21:33 [Bug c/22098] New: [4.0/4.1 Regression] ICE in compound literal gimplification jsm28 at gcc dot gnu dot org
@ 2005-06-16 21:36 ` pinskia at gcc dot gnu dot org
  2005-06-16 21:43 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-16 21:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-16 21:36 -------
Confirmed, this is very related to PR 22013, it might in fact be a dup of that bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |22013
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-16 21:36:53
               date|                            |


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


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

* [Bug c/22098] [4.0/4.1 Regression] ICE in compound literal gimplification
  2005-06-16 21:33 [Bug c/22098] New: [4.0/4.1 Regression] ICE in compound literal gimplification jsm28 at gcc dot gnu dot org
  2005-06-16 21:36 ` [Bug c/22098] " pinskia at gcc dot gnu dot org
@ 2005-06-16 21:43 ` pinskia at gcc dot gnu dot org
  2005-06-16 22:04 ` bangerth at dealii dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-16 21:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-16 21:42 -------
In fact looking at the trees, yes this is a dup of bug 22013 for the non optimizing case we don't 
duplicate the compound literal (well the same one) but with optimization turned on we do.

-- 


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


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

* [Bug c/22098] [4.0/4.1 Regression] ICE in compound literal gimplification
  2005-06-16 21:33 [Bug c/22098] New: [4.0/4.1 Regression] ICE in compound literal gimplification jsm28 at gcc dot gnu dot org
  2005-06-16 21:36 ` [Bug c/22098] " pinskia at gcc dot gnu dot org
  2005-06-16 21:43 ` pinskia at gcc dot gnu dot org
@ 2005-06-16 22:04 ` bangerth at dealii dot org
  2005-06-30 15:00 ` jsm28 at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2005-06-16 22:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-06-16 22:04 -------
>  b = (size_t)(p = &(int []){0, 1, 2}[1]); 
 
What a perverse line of code -- I guess you got what you deserved :-) 
W. 

-- 


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


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

* [Bug c/22098] [4.0/4.1 Regression] ICE in compound literal gimplification
  2005-06-16 21:33 [Bug c/22098] New: [4.0/4.1 Regression] ICE in compound literal gimplification jsm28 at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-06-16 22:04 ` bangerth at dealii dot org
@ 2005-06-30 15:00 ` jsm28 at gcc dot gnu dot org
  2005-07-05 17:50 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-06-30 15:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm28 at gcc dot gnu dot org  2005-06-30 15:00 -------
Testing a patch for bugs 22013 and 22098.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jsm28 at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-06-16 21:36:53         |2005-06-30 15:00:23
               date|                            |


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


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

* [Bug c/22098] [4.0/4.1 Regression] ICE in compound literal gimplification
  2005-06-16 21:33 [Bug c/22098] New: [4.0/4.1 Regression] ICE in compound literal gimplification jsm28 at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-06-30 15:00 ` jsm28 at gcc dot gnu dot org
@ 2005-07-05 17:50 ` cvs-commit at gcc dot gnu dot org
  2005-07-05 19:50 ` [Bug c/22098] [4.0 " pinskia 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 @ 2005-07-05 17:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-05 17:50 -------
Subject: Bug 22098

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2005-07-05 17:50:24

Modified files:
	gcc            : ChangeLog c-objc-common.h c-tree.h c-typeck.c 
	                 langhooks-def.h langhooks.c langhooks.h tree.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/compile: pr22013-1.c 
	gcc/testsuite/gcc.c-torture/execute: pr22098-1.c pr22098-2.c 
	                                     pr22098-3.c 

Log message:
	PR c/22013
	PR c/22098
	* langhooks.h (struct lang_hooks): Add expr_to_decl.
	* langhooks.c (lhd_expr_to_decl): New.
	* langhooks-def.h (lhd_expr_to_decl, LANG_HOOKS_EXPR_TO_DECL):
	New.
	(LANG_HOOKS_INITIALIZER): Update.
	* tree.c (recompute_tree_invarant_for_addr_expr): Call
	expr_to_decl langhook.
	* c-tree.h (c_expr_to_decl): Declare.
	* c-typeck.c (c_expr_to_decl): New.
	(build_unary_op): Do not handle ADDR_EXPR of COMPOUND_LITERAL_EXPR
	specially.
	* c-objc-common.h (LANG_HOOKS_EXPR_TO_DECL): Define.
	
	testsuite:
	* gcc.c-torture/compile/pr22013-1.c,
	gcc.c-torture/execute/pr22098-1.c,
	gcc.c-torture/execute/pr22098-2.c,
	gcc.c-torture/execute/pr22098-3.c: New tests.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9345&r2=2.9346
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-objc-common.h.diff?cvsroot=gcc&r1=2.7&r2=2.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-tree.h.diff?cvsroot=gcc&r1=1.207&r2=1.208
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.463&r2=1.464
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/langhooks-def.h.diff?cvsroot=gcc&r1=1.99&r2=1.100
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/langhooks.c.diff?cvsroot=gcc&r1=1.83&r2=1.84
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/langhooks.h.diff?cvsroot=gcc&r1=1.107&r2=1.108
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&r1=1.493&r2=1.494
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5725&r2=1.5726
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr22013-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr22098-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr22098-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr22098-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c/22098] [4.0 Regression] ICE in compound literal gimplification
  2005-06-16 21:33 [Bug c/22098] New: [4.0/4.1 Regression] ICE in compound literal gimplification jsm28 at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-07-05 17:50 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-05 19:50 ` pinskia at gcc dot gnu dot org
  2005-07-08 13:09 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-05 19:50 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.2


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


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

* [Bug c/22098] [4.0 Regression] ICE in compound literal gimplification
  2005-06-16 21:33 [Bug c/22098] New: [4.0/4.1 Regression] ICE in compound literal gimplification jsm28 at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-07-05 19:50 ` [Bug c/22098] [4.0 " pinskia at gcc dot gnu dot org
@ 2005-07-08 13:09 ` cvs-commit at gcc dot gnu dot org
  2005-07-08 14:48 ` pinskia at gcc dot gnu dot org
  2005-07-08 14:49 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-08 13:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-08 13:08 -------
Subject: Bug 22098

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	jsm28@gcc.gnu.org	2005-07-08 13:08:15

Modified files:
	gcc            : ChangeLog c-objc-common.h c-tree.h c-typeck.c 
	                 langhooks-def.h langhooks.c langhooks.h tree.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/compile: pr22013-1.c 
	gcc/testsuite/gcc.c-torture/execute: pr22098-1.c pr22098-2.c 
	                                     pr22098-3.c 

Log message:
	PR c/22013
	PR c/22098
	* langhooks.h (struct lang_hooks): Add expr_to_decl.
	* langhooks.c (lhd_expr_to_decl): New.
	* langhooks-def.h (lhd_expr_to_decl, LANG_HOOKS_EXPR_TO_DECL):
	New.
	(LANG_HOOKS_INITIALIZER): Update.
	* tree.c (recompute_tree_invarant_for_addr_expr): Call
	expr_to_decl langhook.
	* c-tree.h (c_expr_to_decl): Declare.
	* c-typeck.c (c_expr_to_decl): New.
	(build_unary_op): Do not handle ADDR_EXPR of COMPOUND_LITERAL_EXPR
	specially.
	* c-objc-common.h (LANG_HOOKS_EXPR_TO_DECL): Define.
	
	testsuite:
	* gcc.c-torture/compile/pr22013-1.c,
	gcc.c-torture/execute/pr22098-1.c,
	gcc.c-torture/execute/pr22098-2.c,
	gcc.c-torture/execute/pr22098-3.c: New tests.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.297&r2=2.7592.2.298
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-objc-common.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.4&r2=2.4.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.193.4.4&r2=1.193.4.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.419.2.7&r2=1.419.2.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/langhooks-def.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.97&r2=1.97.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/langhooks.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.81&r2=1.81.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/langhooks.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.104&r2=1.104.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.466.4.4&r2=1.466.4.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.249&r2=1.5084.2.250
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr22013-1.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr22098-1.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr22098-2.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr22098-3.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.6.1



-- 


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


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

* [Bug c/22098] [4.0 Regression] ICE in compound literal gimplification
  2005-06-16 21:33 [Bug c/22098] New: [4.0/4.1 Regression] ICE in compound literal gimplification jsm28 at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-07-08 13:09 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-08 14:48 ` pinskia at gcc dot gnu dot org
  2005-07-08 14:49 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-08 14:48 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 22098 depends on bug 22013, which changed state.

Bug 22013 Summary: [4.0 Regression] ICE in gimple_add_tmp_var, at gimplify.c:535
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22013

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

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


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

* [Bug c/22098] [4.0 Regression] ICE in compound literal gimplification
  2005-06-16 21:33 [Bug c/22098] New: [4.0/4.1 Regression] ICE in compound literal gimplification jsm28 at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2005-07-08 14:48 ` pinskia at gcc dot gnu dot org
@ 2005-07-08 14:49 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-08 14:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-08 14:49 -------
Fixed for 4.0.2 and above.

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


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


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

end of thread, other threads:[~2005-07-08 14:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-16 21:33 [Bug c/22098] New: [4.0/4.1 Regression] ICE in compound literal gimplification jsm28 at gcc dot gnu dot org
2005-06-16 21:36 ` [Bug c/22098] " pinskia at gcc dot gnu dot org
2005-06-16 21:43 ` pinskia at gcc dot gnu dot org
2005-06-16 22:04 ` bangerth at dealii dot org
2005-06-30 15:00 ` jsm28 at gcc dot gnu dot org
2005-07-05 17:50 ` cvs-commit at gcc dot gnu dot org
2005-07-05 19:50 ` [Bug c/22098] [4.0 " pinskia at gcc dot gnu dot org
2005-07-08 13:09 ` cvs-commit at gcc dot gnu dot org
2005-07-08 14:48 ` pinskia at gcc dot gnu dot org
2005-07-08 14:49 ` 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).