------- Comment #13 from rguenth at gcc dot gnu dot org 2007-02-23 09:22 ------- In reply to comment #8
To understand the issues a little bit more -- are there any requirements on overflow behavior of the _base_ type? Suppose a type T with range -100..120 has indeed be assigned a signed char with precision 8 (and so range -128..127). If we now do arithmetic like (to add two Ts) T foo(T t1, T t2) { signed char t1_base = (signed char)t1; signed char t2_base = (signed char)t2; signed char res_base = t1_base + t2_base; if (res_base < 10 || res_base > 120) abort (); return (T)res_base; } is it ok to not raise a constraint error if I happen to add 100 and 100 which wraps on the machine in signed char precision back to a valid value inside the range of T? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30911