[llvm-commits] [test-suite] r128414 - in /test-suite/trunk/SingleSource/Regression/C++: 2011-03-28-Bitfield.cpp 2011-03-28-Bitfield.reference_output
Stuart Hastings
stuart at apple.com
Mon Mar 28 11:21:53 PDT 2011
Author: stuart
Date: Mon Mar 28 13:21:53 2011
New Revision: 128414
URL: http://llvm.org/viewvc/llvm-project?rev=128414&view=rev
Log:
Test case for 128412. <rdar://problem/9186245>
Added:
test-suite/trunk/SingleSource/Regression/C++/2011-03-28-Bitfield.cpp
test-suite/trunk/SingleSource/Regression/C++/2011-03-28-Bitfield.reference_output
Added: test-suite/trunk/SingleSource/Regression/C++/2011-03-28-Bitfield.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C%2B%2B/2011-03-28-Bitfield.cpp?rev=128414&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Regression/C++/2011-03-28-Bitfield.cpp (added)
+++ test-suite/trunk/SingleSource/Regression/C++/2011-03-28-Bitfield.cpp Mon Mar 28 13:21:53 2011
@@ -0,0 +1,39 @@
+// The G++ FE does some constant-folding at -O1 and above; it
+// recognizes the 1,2,3 test can be converted into a range expression
+// ((signed char)(op.datatype-1) < 3). Alas, it generated an
+// ambiguous conversion that was mis-interpreted by the GCC=>LLVM
+// translation phase. <rdar://problem/9186245>
+#include <stdio.h>
+
+typedef struct _operation {
+ unsigned int datatype : 3;
+
+} operation;
+
+operation op;
+
+void __attribute__ ((__noinline__))
+init() {
+ op.datatype = 4;
+}
+
+
+int main( int argc, char *argv[] )
+{
+ init();
+ if( (1 == op.datatype) ||
+ (2 == op.datatype) ||
+ (3 == op.datatype) )
+ {
+ printf( "1, 2 or 3: FAIL\n" );
+ }
+ else if (4 == op.datatype)
+ {
+ printf( "4: PASS\n" );
+ return 0;
+ }
+ else
+ printf( "Not 1,2,3 or 4: FAIL\n" );
+ return -1;
+}
+
Added: test-suite/trunk/SingleSource/Regression/C++/2011-03-28-Bitfield.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C%2B%2B/2011-03-28-Bitfield.reference_output?rev=128414&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Regression/C++/2011-03-28-Bitfield.reference_output (added)
+++ test-suite/trunk/SingleSource/Regression/C++/2011-03-28-Bitfield.reference_output Mon Mar 28 13:21:53 2011
@@ -0,0 +1,2 @@
+4: PASS
+exit 0
More information about the llvm-commits
mailing list