[LLVMbugs] [Bug 4214] New: Internal compile error when function declared with void formal parameter

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu May 14 22:47:01 PDT 2009


           Summary: Internal compile error when function declared with void
                    formal parameter
           Product: new-bugs
           Version: unspecified
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Keywords: crash-on-invalid
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: mike.emmerik at sun.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=2997)
 --> (http://llvm.org/bugs/attachment.cgi?id=2997)
C source code that shows the bug

An Internal Compile Error results when llvm-gcc encounters a function
declaration with a void parameter. This is illegal C, but I found it in some
real code (so some compiler, probably an old version of Sun Studio, must allow
this). In any case, llvm should not fall over on this input.

Steps to reproduce:
1) Create test.c with this content:
typedef void vt;
void (*func_ptr)(vt my_vt);
2) llvm-gcc -c -o test.o test.c

Actual results:
test.c:3: warning: parameter 1 ('my_vt') has void type
Assertion failed: ValueType != Type::VoidTy && "Pointer to void is not valid,
use sbyte* instead!", file Type.cpp, line 1311
test.c:3: internal compiler error: Abort
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.

Expected results:
test.c:3: warning: parameter 1 ('my_vt') has void type
and a valid test.o and test.o.bc.

Build data and platform:
llvm-gcc4.2-2.4 built from source on Solaris 11.

Additional builds and platforms:
Also happens on llvm-gcc4.2-2.5 on Solaris 11.

Additional information:
The following patch fixes the ICE:
*** new.h       Fri May 15 15:07:12 2009
--- ../../llvm-gcc4.2-2.4.source/gcc/llvm-abi.h Fri May 15 15:06:40 2009
*** 421,426 ****
--- 421,428 ----
      // not include variable sized fields here.
      std::vector<const Type*> Elts;
      if (isPassedByInvisibleReference(type)) { // variable size -> by-ref.
+       if (Ty->getTypeID() == Type::VoidTyID)
+         Ty = Type::Int8Ty;  // void* -> sbyte*   Added MVE
        const Type *PtrTy = PointerType::getUnqual(Ty);
        C.HandleByInvisibleReferenceArgument(PtrTy, type);

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