More input: #include <stdio.h>
typedef struct bla { int a; int something; int c; } tBla; int main() { int local; int blub[__builtin_offsetof(tBla, something) + sizeof(local)]; printf("%d\n", sizeof(blub)); return 0; } Run cil with --doheapify --heapifyAll --dosfi --noInsertImplicitCasts and use GCC 4.6 1) (without +offsetof(local)) : test.c:11:4: warning: variably modified 'blub' at file scope [enabled by default] 2) test.c:11:64: error: 'local' undeclared here (not in a function) the local isn't moved to the heap. Maybe this falls into the category of CIL limitations. The "variably modified 'blub' at file scope" is the reason why I prefer CIL not to expand the __builtin_offset(). Thanks! > -----Original Message----- > From: Smets, Jan (Jan) [mailto:jan.sm...@alcatel-lucent.com] > Sent: woensdag 16 mei 2012 21:28 > To: cil-users@lists.sourceforge.net > Subject: [CIL users] __builtin_offsetof > > Hi > > I would like CIL to ignore __builtin_offsetof(). > > But I just can't get the types right. Is there some sort of > 'anyType' or a way to ignore the types? Or perhaps a totally > different approach? > > Thanks. > (Sorry for flooding your mailinglist!) > > > > diff -ur original/cil-1.4.0/src/cil.ml cil-1.4.0/src/cil.ml > --- original/cil-1.4.0/src/cil.ml 2012-05-16 > 21:25:01.240049061 +0200 > +++ cil-1.4.0/src/cil.ml 2012-05-16 21:23:53.434001717 +0200 > @@ -2980,6 +2980,8 @@ > H.add h "__builtin_nansl" (longDoubleType, [ > charConstPtrType ], false); > H.add h "__builtin_next_arg" ((if hasbva then > TBuiltin_va_list [] else voidPtrType), [], false) (* When we > parse builtin_next_arg we drop the argument *); > H.add h "__builtin_object_size" (sizeType, [ voidPtrType; > intType ], false); > + > + H.add h "__builtin_offsetof" (intType, [ string; string ] > , false); > > H.add h "__builtin_parity" (intType, [ uintType ], false); > H.add h "__builtin_parityl" (intType, [ ulongType ], false); > Only in cil-1.4.0/src: .cil.ml.swp > Only in cil-1.4.0/src: formatparse.output > diff -ur original/cil-1.4.0/src/frontc/clexer.mll > cil-1.4.0/src/frontc/clexer.mll > --- original/cil-1.4.0/src/frontc/clexer.mll 2012-05-16 > 21:25:01.245050639 +0200 > +++ cil-1.4.0/src/frontc/clexer.mll 2012-05-16 > 20:56:14.361017922 +0200 > @@ -111,7 +111,7 @@ > (* > ** Keyword hashtable > *) > -let lexicon = H.create 211 > +let lexicon = H.create 210 > let init_lexicon _ = > H.clear lexicon; > List.iter > @@ -213,7 +213,6 @@ > fun _ -> NAMED_TYPE ("__builtin_va_list", currentLoc ())); > ("__builtin_va_arg", fun loc -> BUILTIN_VA_ARG loc); > ("__builtin_types_compatible_p", fun loc -> > BUILTIN_TYPES_COMPAT loc); > - ("__builtin_offsetof", fun loc -> BUILTIN_OFFSETOF loc); > (* On some versions of GCC __thread is a regular identifier *) > ("__thread", fun loc -> > if > !Machdep.theMachine.Machdep.__thread_is_keyword then > -------------------------------------------------------------- > ---------------- > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. > Discussions > will include endpoint security, mobile security and the > latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > CIL-users mailing list > CIL-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/cil-users > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ CIL-users mailing list CIL-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cil-users