[cfe-dev] initializer bug

Keith Bauer onesadcookie at gmail.com
Mon Dec 10 18:26:57 PST 2007


On Dec 1, 2007 6:40 PM, Chris Lattner <clattner at apple.com> wrote:
> Hi Steve,
>
> Can you please investigate this code when you get a chance?
>
> typedef struct { double x,y,z; } VECTOR;
> VECTOR Skycolor[2] = { { 0.5, 0.3, 0.7 }, { 0.0, 0.0, 0.2 } };
> [snip]



Don't know when this was fixed, but thanks to whoever fixed it :)

Here's where I'm at now... one bogus syntax error from a system header
(or is GCC at fault that it doesn't emit an error?)




export CC_ARGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc
-fsyntax-only -D__MACOSX__ -Isource -IOSML -IGameShell/Source/Common
-Ibuild/ppc/root/include -Ibuild/ppc/root/include/freetype2
source/*.[cm]'
ruby -e 'puts "---- gcc --" + "-" * 69'
gcc -mmacosx-version-min=10.4 $CC_ARGS
ruby -e 'puts "---- clang " + "-" * 69'
clang $CC_ARGS
CookieJar:trunk keith$ ./clangy.sh
---- gcc -----------------------------------------------------------------------
---- clang ---------------------------------------------------------------------
In file included from source/ObjectEditorController.m:1:
In file included from
/Developer/SDKs/MacOSX10.4u.sdk//System/Library/Frameworks/WebKit.framework/Headers/WebKit.h:8:
In file included from
/Developer/SDKs/MacOSX10.4u.sdk//System/Library/Frameworks/WebKit.framework/Headers/DOM.h:26:
/Developer/SDKs/MacOSX10.4u.sdk//System/Library/Frameworks/WebKit.framework/Headers/DOMCore.h:95:12:
error: cannot find protocol definition for 'DOMEventTarget',
referenced by 'DOMNode'
@interface DOMNode : DOMObject <DOMEventTarget>
           ^
1 diagnostic generated.





Works fine with the 10.5 SDK, though clang isn't yet warning for
__attribute__((deprecated)):




CookieJar:trunk keith$ cat clangy.sh
export CC_ARGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc
-fsyntax-only -D__MACOSX__ -Isource -IOSML -IGameShell/Source/Common
-Ibuild/ppc/root/include -Ibuild/ppc/root/include/freetype2
source/*.[cm]'
ruby -e 'puts "---- gcc --" + "-" * 69'
gcc -mmacosx-version-min=10.5 $CC_ARGS
ruby -e 'puts "---- clang " + "-" * 69'
clang $CC_ARGS
CookieJar:trunk keith$ ./clangy.sh
---- gcc -----------------------------------------------------------------------
source/mac_keycodes.c: In function 'name_for_keycode':
source/mac_keycodes.c:139: warning: 'GetScriptVariable' is deprecated
(declared at /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Script.h:1174)
source/outnumbered.c: In function 'GSEventInitialize':
source/outnumbered.c:43: warning:
'ATSFontActivateFromFileSpecification' is deprecated (declared at
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Headers/ATSFont.h:283)
---- clang ---------------------------------------------------------------------



Even works for i386 now, thanks to whoever added types for the SSE builtins :)

Code generation isn't quite as pretty.  Every .m file asserts:

Assertion failed: (isa<TypeDecl>(D) && "Only expected type decls
here"), function HandleTopLevelDecl, file ASTConsumers.cpp, line 587.

I assume that's expected.

My .c files trigger four other assertions, this one looks expected:

Assertion failed: (0 && "FIXME: Local VLAs not implemented yet"),
function EmitLocalBlockVarDecl, file CGDecl.cpp, line 105.

(And since I'm not writing C99 anyway I should make it an alloca ;)

The others look genuinely wrong:

Assertion failed: (ExprType->isFunctionType() && "Unknown scalar
value"), function EmitLoadOfLValue, file CGExpr.cpp, line 120.
Assertion failed: (ILE->getType()->isArrayType() ||
ILE->getType()->isStructureType()), function GenerateAggregateInit,
file CodeGenModule.cpp, line 283.
Assertion failed: ((i >= FTy->getNumParams() || FTy->getParamType(i)
== Params[i]->getType()) && "Calling a function with a bad
signature!"), function init, file Instructions.cpp, line 239.

I'll try to track down simple test cases for them and send those
through separately.



As always, keep up the good work :)

-Keith



More information about the cfe-dev mailing list