[LLVMbugs] [Bug 2335] New: llvm-gcc generates llvm. memcpy intrinsics with -ffreestanding flag

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri May 16 04:07:22 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2335

           Summary: llvm-gcc generates llvm.memcpy intrinsics with -
                    ffreestanding flag
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: vjaaskel at cs.tut.fi
                CC: llvmbugs at cs.uiuc.edu


llvm-gcc turns some simple array initializations to llvm.memcpy intrinsics even
if the -ffreestanding flag is given. For example compiling the following code
with '-c --emit-llvm -O2 -ffreestanding' flags

   void foo() {
      char a[11] = "1234567890";
      bar(a);
   }

Initializes the array 'a' with:

   call void @llvm.memcpy.i32( i8* %a1, i8* getelementptr ([11 x i8]* @.str,
i32 0, i32 0), i32 11, i32 1 )


The llvm.memcpy.i32 intrinsic is lowered to a call to memcpy which is a problem
if memcpy is not available. I'm not sure what the correct behavior would be
here, but it doesn't seem right that memcpy is required for a simple array
initialization even if -ffreestanding flag is given.

This problem occurs at least with llvm-gcc-4.2.0 release for llvm 2.2.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list