[cfe-commits] r53928 - /cfe/trunk/lib/CodeGen/CGExprScalar.cpp

Daniel Dunbar daniel at zuster.org
Tue Jul 22 16:06:38 PDT 2008


Good. 

The reason I added the note was the gcc test case that inspired the
patch used __attribute__((aligned(256))) on a function and expected
that to be the __alignof__. Although that doesn't seem to work on my 
current gcc.

 - Daniel



----- Original Message ----
From: Mike Stump <mrs at apple.com>
To: Daniel Dunbar <daniel at zuster.org>
Cc: cfe-commits at cs.uiuc.edu
Sent: Tuesday, July 22, 2008 3:39:45 PM
Subject: Re: [cfe-commits] r53928 - /cfe/trunk/lib/CodeGen/CGExprScalar.cpp

On Jul 22, 2008, at 12:44 PM, Daniel Dunbar wrote:
> Author: ddunbar
> Date: Tue Jul 22 14:44:18 2008
> New Revision: 53928
>
> URL: http://llvm.org/viewvc/llvm-project?rev=53928&view=rev
> Log:
> Add note to check what __alignof__ a function type should be.

If this is represented by:

int(*f)(int);

main() {
   printf("align is %d\n", __alignof__(*f));
}

then gcc gives 1.

> +  // FIXME: what is alignof a function type in gcc?
>   if (TypeToSize->isVoidType() || TypeToSize->isFunctionType())
>     return llvm::ConstantInt::get(llvm::APInt(ResultWidth, 1));




More information about the cfe-commits mailing list