Re: [CIL users] static const

2012-09-17 Thread Gabriel Kerneis
Dear Jan, On Mon, Jul 23, 2012 at 05:45:06PM +0200, Jan Smets wrote: > void f() { > static const unsigned short a = 22; > static const unsigned short b = a - 1; > ... > } Please try the latest CIL from git and use the flag --noMakeStaticGlobal. It solves your issue. Kind regards, -- Gabr

Re: [CIL users] static const

2012-07-24 Thread Jan Smets
Apparently the problem is when this code gets heapified by CIL. GCC 4.6 accepts this code at function scope but not at file scope. Thanks for your answers. - Jan On 24/07/2012 11:00, Oliver Schwahn wrote: > Hi, > I also think that this is invalid C code. Initializers for static local > variables

Re: [CIL users] static const

2012-07-24 Thread Oliver Schwahn
Hi, I also think that this is invalid C code. Initializers for static local variables have to be constant values. Variables with const modifier are not considered a constant value in this context (at least not by gcc, not sure what the standard says). So, the following code does also NOT work..

Re: [CIL users] static const

2012-07-23 Thread Gabriel Kerneis
On Mon, Jul 23, 2012 at 05:45:06PM +0200, Jan Smets wrote: > Is this a valid coding error or a bug in cil ? > static const unsigned short b = a - 1; This is a coding error (or at least gcc refuses to compile it). Not sure about the integer promotion, though. -- Gabriel ---