diff options
author | Joseph Myers <joseph@codesourcery.com> | 2005-08-01 02:29:06 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2005-08-01 02:29:06 +0100 |
commit | 5922c21599d7fdbeb5f63701b5b364df1c086538 (patch) | |
tree | 1fc25d7b6ae7a46e921daa5b71cd0b9af00e1eeb | |
parent | ad7574ac07aa1a3ed7a520f573dddf09d02efd29 (diff) | |
download | gcc-5922c21599d7fdbeb5f63701b5b364df1c086538.zip gcc-5922c21599d7fdbeb5f63701b5b364df1c086538.tar.gz gcc-5922c21599d7fdbeb5f63701b5b364df1c086538.tar.bz2 |
re PR c/22311 (internal compiler error: in c_common_type (-fshort-enums))
PR c/22311
* c-typeck.c (build_binary_op): Use common_type wrapper on
shortened types.
(common_type): Update comment.
testsuite:
* gcc.dg/pr22311-1.c : New test.
From-SVN: r102615
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-typeck.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr22311-1.c | 6 |
4 files changed, 21 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f20a528..d010f6b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-08-01 Joseph S. Myers <joseph@codesourcery.com> + + PR c/22311 + * c-typeck.c (build_binary_op): Use common_type wrapper on + shortened types. + (common_type): Update comment. + 2005-07-31 Steven Bosscher <stevenb@suse.de> PR target/23095 diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index eb7909e..c049895 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -637,7 +637,8 @@ c_common_type (tree t1, tree t2) return t2; } -/* Wrapper around c_common_type that is used by c-common.c. ENUMERAL_TYPEs +/* Wrapper around c_common_type that is used by c-common.c and other + front end optimizations that remove promotions. ENUMERAL_TYPEs are allowed here and are converted to their compatible integer types. BOOLEAN_TYPEs are allowed here and return either boolean_type_node or preferably a non-Boolean type as the common type. */ @@ -7948,7 +7949,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, && (unsigned0 || !uns)) result_type = c_common_signed_or_unsigned_type - (unsigned0, c_common_type (TREE_TYPE (arg0), TREE_TYPE (arg1))); + (unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1))); else if (TREE_CODE (arg0) == INTEGER_CST && (unsigned1 || !uns) && (TYPE_PRECISION (TREE_TYPE (arg1)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 968118f..29b67a9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-08-01 Joseph S. Myers <joseph@codesourcery.com> + + PR c/22311 + * gcc.dg/pr22311-1.c : New test. + 2005-07-31 Steven Bosscher <stevenb@suse.de> PR target/23095 diff --git a/gcc/testsuite/gcc.dg/pr22311-1.c b/gcc/testsuite/gcc.dg/pr22311-1.c new file mode 100644 index 0000000..4eec5ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr22311-1.c @@ -0,0 +1,6 @@ +/* Bug 22311: ICE with -fshort-enums on shortened operations. */ +/* { dg-do compile } */ +/* { dg-options "-fshort-enums" } */ + +typedef enum { A = 1 } E; +void f(E e, unsigned char c) { c |= e; } |