+2008-10-19 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c/30260
+ * c-decl.c (finish_enum): Convert non-integer enumerators to enum
+ type.
+ (build_enumerator): Convert enumerators that fit in integer to
+ integer type.
+
2008-10-18 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (unnamed peephole2): Do not force memory
PR ada/36554
* dwarf2out.c (is_subrange_type): Deal with BOOLEAN_TYPE.
-2008-07-30 Rafael Ãvila de EspÃndola <espindola@google.com>
+2008-07-30 Rafael Ã\81vila de Espíndola <espindola@google.com>
PR 36974
* final.c (call_from_call_insn): Handle COND_EXEC.
* config/rs6000/rs6000.h (SLOW_UNALIGNED_ACCESS): Add clause for
vector modes.
-2008-07-30 Rafael Ãvila de EspÃndola <espindola@google.com>
+2008-07-30 Rafael Ã\81vila de Espíndola <espindola@google.com>
* final.c (call_from_call_insn): New.
(final_scan_insn): Call assemble_external on FUNCTION_DECLs.
(TARGET_OPTION_PRINT): Ditto.
(TARGET_CAN_INLINE_P): Ditto.
-2008-07-22 Rafael Ãvila de EspÃndola <espindola@google.com>
+2008-07-22 Rafael Ã\81vila de Espíndola <espindola@google.com>
* c-typeck.c (build_external_ref): Don't call assemble_external.
* final.c (output_operand): Call assemble_external.
highest magnitude if this is still less or equal to the true
quotient in magnitude.
-2008-07-21 Rafael Ãvila de EspÃndola <espindola@google.com>
+2008-07-21 Rafael Ã\81vila de Espíndola <espindola@google.com>
* Makefile.in: Replace toplev.h with TOPLEV_H.
* c-decl.c (merge_decls): Don't set DECL_IN_SYSTEM_HEADER.
(m32c_legitimate_address_p): Handle "++rii" addresses created by
m32c_legitimize_reload_address.
-2007-07-16 Rafael Ãvila de EspÃndola <espindola@google.com>
+2007-07-16 Rafael Ã\81vila de Espíndola <espindola@google.com>
* c-decl.c (merge_decls): Keep DECL_SOURCE_LOCATION and
DECL_IN_SYSTEM_HEADER in sync.
* emit-rtl.c (set_mem_attributes_minus_bitpos): Improve comment.
-2007-07-14 Rafael Ãvila de EspÃndola <espindola@google.com>
+2007-07-14 Rafael Ã\81vila de Espíndola <espindola@google.com>
* c-decl.c (diagnose_mismatched_decls): Don't warn if TREE_NO_WARNING
is set.
/* The ISO C Standard mandates enumerators to have type int,
even though the underlying type of an enum type is
unspecified. However, GCC allows enumerators of any
- integer type as an extensions. Here we convert any
- enumerators that fit in an int to type int, to avoid
- promotions to unsigned types when comparing integers with
- enumerators that fit in the int range. When -pedantic is
- given, build_enumerator() would have already warned about
- those that don't fit. */
- if (int_fits_type_p (ini, integer_type_node))
- tem = integer_type_node;
- else
- tem = enumtype;
- ini = convert (tem, ini);
+ integer type as an extensions. build_enumerator()
+ converts any enumerators that fit in an int to type int,
+ to avoid promotions to unsigned types when comparing
+ integers with enumerators that fit in the int range.
+ When -pedantic is given, build_enumerator() would have
+ already warned about those that don't fit. Here we
+ convert the rest to the enumerator type. */
+ if (TREE_TYPE (ini) != integer_type_node)
+ ini = convert (enumtype, ini);
DECL_INITIAL (enu) = ini;
TREE_PURPOSE (pair) = DECL_NAME (enu);
pedwarn (value_loc, OPT_pedantic,
"ISO C restricts enumerator values to range of %<int%>");
+ /* The ISO C Standard mandates enumerators to have type int, even
+ though the underlying type of an enum type is unspecified.
+ However, GCC allows enumerators of any integer type as an
+ extensions. Here we convert any enumerators that fit in an int
+ to type int, to avoid promotions to unsigned types when comparing
+ integers with enumerators that fit in the int range. When
+ -pedantic is given, we would have already warned about those that
+ don't fit. We have to do this here rather than in finish_enum
+ because this value may be used to define more enumerators. */
+ if (int_fits_type_p (value, integer_type_node))
+ value = convert (integer_type_node, value);
+
/* Set basis for default for next value. */
the_enum->enum_next_value
= build_binary_op