[cfe-commits] r166266 - in /cfe/trunk: lib/CodeGen/ABIInfo.h lib/CodeGen/CGCall.cpp lib/CodeGen/TargetInfo.cpp test/CodeGenCXX/regparm.cpp

Eli Friedman eli.friedman at gmail.com
Mon Oct 22 16:58:31 PDT 2012


On Thu, Oct 18, 2012 at 10:04 PM, Rafael Espindola
<rafael.espindola at gmail.com> wrote:
> Author: rafael
> Date: Fri Oct 19 00:04:37 2012
> New Revision: 166266
>
> URL: http://llvm.org/viewvc/llvm-project?rev=166266&view=rev
> Log:
> Fix handling of the regparm attribute in the presence of classes with copy
> constructors.
>
> When I first moved regparm support to TargetInfo.cpp I tried to isolate it
> in classifyArgumentTypeWithReg, but it is actually a lot easier to flip the
> code around and check for regparm at the end of the decision tree.
>
> Without this refactoring classifyArgumentTypeWithReg would have to duplicate
> the logic about when to use non-byval indirect arguments.

This commit is causing clang to eat memory on the following testcase,
derived from the gcc testsuite (x86-32):

struct x {
  struct {
    struct {} b[0];
  } a;
};
__attribute((regparm(2))) void f(x a) {}

The issue is that X86_32ABIInfo::classifyArgumentType is returning
ABIArgInfo::getDirectInReg with a struct with zero members, which
confuses CodeGenModule::ConstructAttributeList.

-Eli



More information about the cfe-commits mailing list