ICE outputting unaligned fp constant on powerpc-apple-darwin5.1

Stuart Hastings stuart@apple.com
Tue Dec 18 11:30:00 GMT 2001


This is an expanded revision of a test program previously submitted as

http://gcc.gnu.org/ml/gcc-patches/2001-12/msg00521.html

stuart hastings

2001-12-05 Stuart Hastings <stuart@apple.com>

          * gcc/gcc/testsuite/gcc.c-torture/execute/20011203-1.c: New
          test for misaligned double initialization.

*** /dev/null   Tue Dec 18 09:07:01 2001
--- gcc/gcc/testsuite/gcc.c-torture/execute/20011203-1.c        Mon Dec 
17 13:42:03 2001
***************
*** 0 ****
--- 1,58 ----
+ /* Simple alignment checks;
+    looking for compiler/assembler alignment disagreements,
+    agreement between struct initialization and access.  */
+ struct a_short { char c; short s; } s_c_s = { 'a', 13 };
+ struct a_int { char c ; int i; } s_c_i = { 'b', 14 };
+ struct b_int { short s; int i; } s_s_i  = { 15, 16 };
+ struct a_float { char c; float f; } s_c_f = { 'c', 17.0 };
+ struct b_float { short s; float f; } s_s_f = { 18, 19.0 };
+ struct a_double { char c; double d; } s_c_d = { 'd', 20.0 };
+ struct b_double { short s; double d; } s_s_d = { 21, 22.0 };
+ struct c_double { int i; double d; } s_i_d = { 23, 24.0 };
+ struct d_double { float f; double d; } s_f_d = { 25.0, 26.0 };
+ struct a_ldouble { char c; long double ld; } s_c_ld = { 'e', 27.0 };
+ struct b_ldouble { short s; long double ld; } s_s_ld = { 28, 29.0 };
+ struct c_ldouble { int i; long double ld; } s_i_ld = { 30, 31.0 };
+ struct d_ldouble { float f; long double ld; } s_f_ld = { 32.0, 33.0 };
+ struct e_ldouble { double d; long double ld; } s_d_ld = { 34.0, 35.0 };
+
+ void static fail (char *problem)
+ {
+   printf (problem);
+   printf ("\n");
+   abort ();
+ }
+
+ int main ()
+ {
+   if (s_c_s.c != 'a') fail ("fetch character from character and short 
struct");
+   if (s_c_s.s != 13) fail ("fetch short from character and short 
struct");
+   if (s_c_i.c != 'b') fail ("fetch character from character and int 
struct");
+   if (s_c_i.i != 14) fail ("fetch integer from character and int 
struct");
+   if (s_s_i.s != 15) fail ("fetch short from short and int struct");
+   if (s_s_i.i != 16) fail ("fetch int from short and int struct");
+   if (s_c_f.c != 'c') fail ("fetch character from character and float 
struct");
+   if (s_c_f.f != 17.0) fail ("fetch float from character and float 
struct");
+   if (s_s_f.s != 18) fail ("fetch short from short and float struct");
+   if (s_s_f.f != 19.0) fail ("fetch float from short and float 
struct");
+   if (s_c_d.c != 'd') fail ("fetch character from character and double 
struct");
+   if (s_c_d.d != 20.0) fail ("fetch double from character and double 
struct");
+   if (s_s_d.s != 21) fail ("fetch short from short and double struct");
+   if (s_s_d.d != 22.0) fail ("fetch double from short and double 
struct");
+   if (s_i_d.i != 23) fail ("fetch int from int and double struct");
+   if (s_i_d.d != 24.0) fail ("fetch double from int and double 
struct");
+   if (s_f_d.f != 25.0) fail ("fetch float from float and double 
struct");
+   if (s_f_d.d != 26.0) fail ("fetch double from float and double 
struct");
+   if (s_c_ld.c != 'e') fail ("fetch character from character and long 
double struct");
+   if (s_c_ld.ld != 27.0) fail ("fetch long double from character and 
long double struct");
+   if (s_s_ld.s != 28) fail ("fetch short from short and long double 
struct");
+   if (s_s_ld.ld != 29.0) fail ("fetch long double from short and long 
double struct");
+   if (s_i_ld.i != 30) fail ("fetch int from int and long double 
struct");
+   if (s_i_ld.ld != 31.0) fail ("fetch long double from int and long 
double struct");
+   if (s_f_ld.f != 32.0) fail ("fetch float from float and long double 
struct");
+   if (s_f_ld.ld != 33.0) fail ("fetch long double from float and long 
double struct");
+   if (s_d_ld.d != 34.0) fail ("fetch double from double and long 
double struct");
+   if (s_d_ld.ld != 35.0) fail ("fetch long double from double and long 
double struct");
+   exit (0);
+   return (0);
+ }



More information about the Gcc-patches mailing list