------- Additional Comments From fw at deneb dot enyo dot de 2005-05-30 17:50 ------- In expand_case, we have:
<switch_expr 0xb7b242f8 type <integer_type 0xb7b5a798 system__unsigned_types__unsigned sizes-gimplified public visited unsigned SI size <integer_cst 0xb7b173f0 constant invariant visited 32> unit size <integer_cst 0xb7b17180 constant invariant visited 4> user align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0xb7b57300 0> max <integer_cst 0xb7b572a0 4294967295> RM size <integer_cst 0xb7b173f0 32>> side-effects asm_written arg 0 <parm_decl 0xb7b5a288 A type <enumeral_type 0xb7b5a21c bug2_p__t readonly sizes-gimplified unsigned QI size <integer_cst 0xb7b171f8 constant invariant visited 8> unit size <integer_cst 0xb7b17210 constant invariant visited 1> user align 8 symtab 0 alias set -1 precision 8 min <integer_cst 0xb7b47e58 2> max <integer_cst 0xb7b570a8 7> RM size <integer_cst 0xb7b171f8 8>> readonly unsigned QI file /tmp/bug2_p.ads line 4 size <integer_cst 0xb7b171f8 8> unit size <integer_cst 0xb7b17210 1> align 8 context <function_decl 0xb7b5a438 bug2_p__tRP> result <integer_type 0xb7b1e510 integer sizes-gimplified public visited SI size <integer_cst 0xb7b173f0 32> unit size <integer_cst 0xb7b17180 4> align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0xb7b173a8 -2147483648> max <integer_cst 0xb7b173c0 2147483647> pointer_to_this <pointer_type 0xb7b1ee58>> initial <integer_type 0xb7b1e510 integer> (reg/v:QI 60 [ A ]) arg-type <integer_type 0xb7b1e510 integer> arg-type-as-written <integer_type 0xb7b1e510 integer> incoming-rtl (mem/i:SI (reg/f:SI 53 virtual-incoming-args) [7 A+0 S1 A32]) chain <parm_decl 0xb7b5a360 F type <enumeral_type 0xb7b5a2f4 boolean> readonly unsigned QI file /tmp/bug2_p.ads line 4 size <integer_cst 0xb7b171f8 8> unit size <integer_cst 0xb7b17210 1> align 8 context <function_decl 0xb7b5a438 bug2_p__tRP> result <integer_type 0xb7b1e510 integer> initial <integer_type 0xb7b1e510 integer> (reg/v:QI 62 [ F ]) arg-type <integer_type 0xb7b1e510 integer> arg-type-as-written <integer_type 0xb7b1e510 integer> incoming-rtl (mem/i:SI (plus:SI (reg/f:SI 53 virtual-incoming-args) (const_int 4 [0x4])) [2 F+0 S1 A32])>> arg 2 <tree_vec 0xb7b24320 elt 0 <case_label_expr 0xb7b241e0> elt 1 <case_label_expr 0xb7b24208> elt 2 <case_label_expr 0xb7b24230> elt 3 <case_label_expr 0xb7b24258> elt 4 <case_label_expr 0xb7b24280>> /tmp/bug2_p.ads:4> Please note the min and max values of the enumeral_type. The cause seems to be that exp_ch3.adb emits the rep-to-pos function as follows: -- function _Rep_To_Pos (A : etype; F : Boolean) return Integer is -- begin -- case ityp!(A) is -- when enum-lit'Enum_Rep => return posval; -- when enum-lit'Enum_Rep => return posval; -- ... -- when others => -- [raise Constraint_Error when F "invalid data"] -- return -1; -- end case; -- end; I think the argument A should be of a suitable integer type, not the enumeration type, but this might only hide the bug. Maybe Ada should even refrain from setting TYPE_MIN_VALUE and TYPE_MAX_VALUE on its enumeration types. -- What |Removed |Added ---------------------------------------------------------------------------- Component|rtl-optimization |ada http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21573