This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Reference: http://gcc.gnu.org/ml/gcc/2001-11/msg01595.html

Here is a new testcase to detect this (TARGET_POWERPC specific)
problem automatically in the future.

I was unable to find any documentation about naming
testcases. Apologies if I have misnamed this testcase.

I'll submit a GCC fix shortly.

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.

Index: gcc/gcc/testsuite/gcc.c-torture/execute/20011203-1.c
===================================================================
*** /dev/null   Wed Dec  5 03:15:00 2001
--- gcc/gcc/testsuite/gcc.c-torture/execute/20011203-1.c        Mon Dec  
3 16:05:44 2001
***************
*** 0 ****
--- 1,40 ----
+ /* simple alignment checks */
+ 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 };
+
+ void static fail (char *problem)
+ {
+   printf (problem);
+   abort ();
+ }
+
+ int main ()
+ {
+   if (s_c_s.c != 'a') fail ("s_c_s.c");
+   if (s_c_s.s != 13) fail ("s_c_s.s");
+   if (s_c_i.c != 'b') fail ("s_c_i.c");
+   if (s_c_i.i != 14) fail ("s_c_i.i");
+   if (s_s_i.s != 15) fail ("s_s_i.s");
+   if (s_s_i.i != 16) fail ("s_s_i.i");
+   if (s_c_f.c != 'c') fail ("s_c_f.c");
+   if (s_c_f.f != 17.0) fail ("s_c_f.f");
+   if (s_s_f.s != 18) fail ("s_s_f.s");
+   if (s_s_f.f != 19.0) fail ("s_s_f.f");
+   if (s_c_d.c != 'd') fail ("s_c_d.c");
+   if (s_c_d.d != 20.0) fail ("s_c_d.d");
+   if (s_s_d.s != 21) fail ("s_s_d.s");
+   if (s_s_d.d != 22.0) fail ("s_s_d.d");
+   if (s_i_d.i != 23) fail ("s_i_d.i");
+   if (s_i_d.d != 24.0) fail ("s_i_d.d");
+   if (s_f_d.f != 25.0) fail ("s_f_d.f");
+   if (s_f_d.d != 26.0) fail ("s_f_d.d");
+   exit (0);
+   return (0);
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]