[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Segmentation fault compiling jslong.c

From: Rob Landley
Subject: Re: [Tinycc-devel] Segmentation fault compiling jslong.c
Date: Thu, 20 Sep 2007 20:45:06 -0500
User-agent: KMail/1.9.6

On Thursday 20 September 2007 4:02:12 pm Gregg Reynolds wrote:
> On 9/20/07, Rob Landley <address@hidden> wrote:
> > I'm wondering if there's some circumstance under which it _should_
> > generate code that runs before "main", and if so how I'd go about it. 
> > (The "no, it should enver do this" is the easy case to fix, but I'm
> > unsure whether or not that's the case...)
> Doesn't look like it to me.  See section 6.6 of the c99 draft
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf

Er, possibly you mean:  http://landley.net/c99-draft.html#6.7.8
Bullet point #4?

> Although technically I suppose you could do constant initializations
> at run-time instead of translation-time, so long as they're done
> before main.

No, if it's constant Id like to work it out at compile time.  The generated 
code is slow enough, and we already do this for most stuff. :)

> The key point being whether it's a constant expression, 
> not time of evaluation.

Yup.  Losing track of the constness of a long long shift is a separate bug.  
The segfault can be reproduced by starting a file with: int i=printf("");

"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]