[LLVMbugs] [Bug 158] [llvm-gcc] CFE produces non-type-safe code, gccas rejects it

bugzilla-daemon at zion.cs.uiuc.edu bugzilla-daemon at zion.cs.uiuc.edu
Thu Nov 27 13:25:59 PST 2003


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=158

sabre at nondot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From sabre at nondot.org  2003-11-27 15:25 -------
Fixed.

Testcase: test/Regression/CFrontend/2003-11-27-UnionCtorInitialization.c

Patch:
$ diff -u llvm-expand.c~ llvm-expand.c
--- llvm-expand.c~      2003-11-27 14:43:10.000000000 -0600
+++ llvm-expand.c       2003-11-27 15:22:45.000000000 -0600
@@ -3697,6 +3697,11 @@
   llvm_value *Offset;
   unsigned i;
 
+  /* Initializing a union can cause the value type to disagree with the
+   * destination type.
+   */
+  target = cast_if_type_not_equal(Fn, target, llvm_type_get_pointer(Ty));
+
   if (Ty->ID == StructTyID) {
     for (i = 0; i != Size; ++i)
       /* Composite elements handled already */

-Chris



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list