* [Bug c/19342] internal compiler error: in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
@ 2005-01-09 7:10 ` aj at gcc dot gnu dot org
2005-01-09 7:15 ` aj at gcc dot gnu dot org
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: aj at gcc dot gnu dot org @ 2005-01-09 7:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From aj at gcc dot gnu dot org 2005-01-09 07:10 -------
Created an attachment (id=7910)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7910&action=view)
Preprocessed source file - i386 compilation
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] internal compiler error: in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
2005-01-09 7:10 ` [Bug c/19342] " aj at gcc dot gnu dot org
@ 2005-01-09 7:15 ` aj at gcc dot gnu dot org
2005-01-09 10:50 ` steven at gcc dot gnu dot org
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: aj at gcc dot gnu dot org @ 2005-01-09 7:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From aj at gcc dot gnu dot org 2005-01-09 07:15 -------
Btw. error did not occur with GCC CVS from 20050103 and the next one tested
was from 20050108.
--
What |Removed |Added
----------------------------------------------------------------------------
Summary| internal compiler error: in|internal compiler error: in
|common_type, at c- |common_type, at c-
|typeck.c:490 |typeck.c:490
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] internal compiler error: in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
2005-01-09 7:10 ` [Bug c/19342] " aj at gcc dot gnu dot org
2005-01-09 7:15 ` aj at gcc dot gnu dot org
@ 2005-01-09 10:50 ` steven at gcc dot gnu dot org
2005-01-09 11:12 ` steven at gcc dot gnu dot org
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-09 10:50 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
GCC build triplet|* |
GCC host triplet|* |
GCC target triplet|* |
Last reconfirmed|0000-00-00 00:00:00 |2005-01-09 10:50:20
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] internal compiler error: in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (2 preceding siblings ...)
2005-01-09 10:50 ` steven at gcc dot gnu dot org
@ 2005-01-09 11:12 ` steven at gcc dot gnu dot org
2005-01-09 11:15 ` [Bug c/19342] [4.0 regression] ICE " steven at gcc dot gnu dot org
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-09 11:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2005-01-09 11:12 -------
typedef enum {
ORANGE,
GRAPE
} fruit;
struct list {
fruit __attribute__ ((mode (__byte__))) elt;
fruit __attribute__ ((mode (__byte__))) next_elt;
};
void bar (void);
void
foo (struct list *l, int a)
{
if (l->elt != l->next_elt)
bar();
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (3 preceding siblings ...)
2005-01-09 11:12 ` steven at gcc dot gnu dot org
@ 2005-01-09 11:15 ` steven at gcc dot gnu dot org
2005-01-09 15:35 ` pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-09 11:15 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Keywords| |ice-on-valid-code
Known to fail| |4.0.0
Known to work| |3.3.4 3.4.2
Priority|P2 |P1
Summary|internal compiler error: in |[4.0 regression] ICE in
|common_type, at c- |common_type, at c-
|typeck.c:490 |typeck.c:490
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (4 preceding siblings ...)
2005-01-09 11:15 ` [Bug c/19342] [4.0 regression] ICE " steven at gcc dot gnu dot org
@ 2005-01-09 15:35 ` pinskia at gcc dot gnu dot org
2005-01-10 11:28 ` jakub at gcc dot gnu dot org
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-09 15:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-09 15:35 -------
The only obvious change which caused this would be:
2005-01-07 Jakub Jelinek <jakub@redhat.com>
* c-common.c (handle_mode_attribute): For ENUMERAL_TYPE, also copy
TYPE_MODE.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (5 preceding siblings ...)
2005-01-09 15:35 ` pinskia at gcc dot gnu dot org
@ 2005-01-10 11:28 ` jakub at gcc dot gnu dot org
2005-01-18 13:36 ` jakub at gcc dot gnu dot org
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-01-10 11:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jakub at gcc dot gnu dot org 2005-01-10 11:28 -------
Yes, my patch clearly triggers this (changing silent miscompilation of the
code into an ICE).
The problem is that common_type doesn't handle ENUMERAL_TYPEs, so probably
shorten_compare should made sure it doesn't get passed down.
The difference is that while previously shorten_compare was passed CONVERT_EXPRs,
created in convert.c's
/* If the precision of the EXPR's type is K bits and the
destination mode has more bits, and the sign is changing,
it is not safe to use a NOP_EXPR. For example, suppose
that EXPR's type is a 3-bit unsigned integer type, the
TYPE is a 3-bit signed integer type, and the machine mode
for the types is 8-bit QImode. In that case, the
conversion necessitates an explicit sign-extension. In
the signed-to-unsigned case the high-order bits have to
be cleared. */
if (TYPE_UNSIGNED (type) != TYPE_UNSIGNED (TREE_TYPE (expr))
&& (TYPE_PRECISION (TREE_TYPE (expr))
!= GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (expr)))))
code = CONVERT_EXPR;
else
code = NOP_EXPR;
return build1 (code, type, expr);
now, when the mode is fixed, we pass NOP_EXPR. So, before my patch primop{0,1}'s
type was int while now it is that enum __attribute__((mode(byte))).
Now, C++ common_type handles ENUMERAL_TYPEs, so I don't think it is appropriate
to special case ENUMERAL_TYPEs in shorten_compare which is shared between
C/C++/ObjC. So perhaps add code to handle ENUMERAL_TYPEs in C common_type?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (6 preceding siblings ...)
2005-01-10 11:28 ` jakub at gcc dot gnu dot org
@ 2005-01-18 13:36 ` jakub at gcc dot gnu dot org
2005-01-18 14:43 ` joseph at codesourcery dot com
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-01-18 13:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jakub at gcc dot gnu dot org 2005-01-18 13:35 -------
Note that GCC 3.4's common_type handled ENUMERAL_TYPEs.
This was removed in PR13519 patch.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |joseph at codesourcery dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (7 preceding siblings ...)
2005-01-18 13:36 ` jakub at gcc dot gnu dot org
@ 2005-01-18 14:43 ` joseph at codesourcery dot com
2005-01-18 18:28 ` jakub at gcc dot gnu dot org
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: joseph at codesourcery dot com @ 2005-01-18 14:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From joseph at codesourcery dot com 2005-01-18 14:39 -------
Subject: Re: [4.0 regression] ICE in common_type, at c-typeck.c:490
On Tue, 18 Jan 2005, jakub at gcc dot gnu dot org wrote:
> Note that GCC 3.4's common_type handled ENUMERAL_TYPEs.
> This was removed in PR13519 patch.
Indeed, previously common_type did not have a well-defined purpose or
interface and tried to do three different things. Now it is well-defined:
/* Return the common type for two arithmetic types under the usual
arithmetic conversions. The default conversions have already been
applied, and enumerated types converted to their compatible integer
types.
So under the interface currently specified it shouldn't receive enumerated
types.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (8 preceding siblings ...)
2005-01-18 14:43 ` joseph at codesourcery dot com
@ 2005-01-18 18:28 ` jakub at gcc dot gnu dot org
2005-01-18 20:10 ` joseph at codesourcery dot com
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-01-18 18:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jakub at gcc dot gnu dot org 2005-01-18 18:28 -------
But did this change for all frontends or just C?
In the code in question common_type is used by code common to C and C++.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (9 preceding siblings ...)
2005-01-18 18:28 ` jakub at gcc dot gnu dot org
@ 2005-01-18 20:10 ` joseph at codesourcery dot com
2005-01-28 0:17 ` steven at gcc dot gnu dot org
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: joseph at codesourcery dot com @ 2005-01-18 20:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From joseph at codesourcery dot com 2005-01-18 20:10 -------
Subject: Re: [4.0 regression] ICE in common_type, at c-typeck.c:490
On Tue, 18 Jan 2005, jakub at gcc dot gnu dot org wrote:
> But did this change for all frontends or just C?
> In the code in question common_type is used by code common to C and C++.
I think the underlying problems there are (1) undesigned ad hoc sharing
between the front ends, (2) this language-specific function being called
from what's essentially an optimization, not only on types that appear
directly in the source as operands to which usual arithmetic conversions
are to be applies, (3) this optimization happens at this stage at all,
rather than later in a language-independent way that doesn't need to call
back into front ends. Short term, allowing enumerated types in
common_type for C for this special case would make sense as a fix for this
bug.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (10 preceding siblings ...)
2005-01-18 20:10 ` joseph at codesourcery dot com
@ 2005-01-28 0:17 ` steven at gcc dot gnu dot org
2005-01-28 6:26 ` jakub at gcc dot gnu dot org
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-28 0:17 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2005-01-28 00:16 -------
Jakub, what's the plan with this one, are you going to fix it?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (11 preceding siblings ...)
2005-01-28 0:17 ` steven at gcc dot gnu dot org
@ 2005-01-28 6:26 ` jakub at gcc dot gnu dot org
2005-02-09 8:13 ` steven at gcc dot gnu dot org
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-01-28 6:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jakub at gcc dot gnu dot org 2005-01-28 06:26 -------
Patch here <http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01218.html>.
This one fixes the testcase, but while writing a larger testcase I found
other unrelated bugs that aren't fixed yet.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (12 preceding siblings ...)
2005-01-28 6:26 ` jakub at gcc dot gnu dot org
@ 2005-02-09 8:13 ` steven at gcc dot gnu dot org
2005-02-10 18:07 ` cvs-commit at gcc dot gnu dot org
2005-02-10 18:12 ` jakub at gcc dot gnu dot org
15 siblings, 0 replies; 17+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-02-09 8:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2005-02-08 23:52 -------
Jakub, so why not get your patch of comment #11 in first, and worry about the,
as you say yourself, unrelated bugs later?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (13 preceding siblings ...)
2005-02-09 8:13 ` steven at gcc dot gnu dot org
@ 2005-02-10 18:07 ` cvs-commit at gcc dot gnu dot org
2005-02-10 18:12 ` jakub at gcc dot gnu dot org
15 siblings, 0 replies; 17+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-02-10 18:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-02-10 12:19 -------
Subject: Bug 19342
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: jakub@gcc.gnu.org 2005-02-10 12:18:52
Modified files:
gcc : ChangeLog c-typeck.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gcc.c-torture/execute: 20050119-1.c
Log message:
PR c/19342
* c-typeck.c (common_type): New routine. Old common_type renamed
to...
(c_common_type): ...this.
(build_conditional_expr, build_binary_op): Use c_common_type instead
of common_type.
* gcc.c-torture/execute/20050119-1.c: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7429&r2=2.7430
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.417&r2=1.418
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5014&r2=1.5015
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20050119-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c/19342] [4.0 regression] ICE in common_type, at c-typeck.c:490
2005-01-09 7:09 [Bug c/19342] New: internal compiler error: in common_type, at c-typeck.c:490 aj at gcc dot gnu dot org
` (14 preceding siblings ...)
2005-02-10 18:07 ` cvs-commit at gcc dot gnu dot org
@ 2005-02-10 18:12 ` jakub at gcc dot gnu dot org
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-02-10 18:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jakub at gcc dot gnu dot org 2005-02-10 12:20 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19342
^ permalink raw reply [flat|nested] 17+ messages in thread