Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers LCC > Re: What can I ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 22 of 23 Topic 955 of 1070
Post > Topic >>

Re: What can I do?

by Keith Thompson <kst-u@[EMAIL PROTECTED] > Jun 3, 2007 at 01:08 PM

Dave Hanson <drhanson@[EMAIL PROTECTED]
> writes:
> On Jun 2, 3:09 pm, jacob navia <j...@[EMAIL PROTECTED]
> wrote:
>> ...
>> Is there a limit that the standard for this? In the limits section
>> (5.2.4.1) the standard does NOT mention this kind of limit, at
>> least as far as I can see (PLEASE correct me, I would be happy to be
>> wrong! :-) )
>
> The expression you show is equivalent to its fully parenthesized
> variant. Sec. 5.2.4.1 stipulates "63 nesting levels of parenthesized
> expressions within a full expression." I suspect your example--when
> parenthesized fully--exceeds this limit. Of course, lcc shouldn't
> crash; it should issue a diagnostic, as it does when other limits are
> exceeded, e.g., when there are too many initializers.

I'm not convinced that it's equivalent as far as 5.2.4.1 is concerned.
For example, the expression 42 is equivalent to (((...(((42)))...)))
(64 nesting levels); the latter exceeds the limit, but 42 by itself
does not.

But keep in mind that the limits in 5.2.4.1 are applied *very*
narrowly.  The implementation must translate and execute *one* program
that hits every one of the limits.  The standard says nothing about
any *other* program that meets or exceeds any of those limits, or
about any measures of size or complexity that aren't enumerated in
5.2.4.1.

The intent of 5.2.4.1, I think, is to discourage implementers from
imposing arbitrary fixed limits.  The easiest way to meet the
requirement (to handle *one* complex program) is probably to make all
the compiler's internal data structures dynamic, so the only
limitations are those imposed by compile-time resource constraints.

A conforming compiler cannot reasonably be required to handle
arbitrarily large and complex translation units; nobody expects a
compiler to handle a 3-yottabyte source file.  It can only be expected
to do the best it can given the resources available to it.  (I think
an explicit statement to that effect in the standard would be a good
thing; if nothing else, it might have forestalled this discussion.)

My advice:

1. Increasing the compiler's available stack space, assuming the
underlying OS provides a way to do this, might alleviate the problem.
Adding more physical RAM to the computer might be one way to do this.

2. If practical, the compiler should abort with an error message
rather than blowing up.

3. The program that generates the offending code should be modified to
generate simpler code, probably by breaking the huge expression into
smaller parts using tem****ary variables.

-- 
Keith Thompson (The_Other_Keith) kst-u@[EMAIL PROTECTED]
 
<http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*> 
<http://users.sdsc.edu/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
 




 23 Posts in Topic:
What can I do?
jacob navia <jacob@[EM  2007-06-03 00:09:22 
Re: What can I do?
Gregor H. <nomail@[EMA  2007-06-03 00:16:04 
Re: What can I do?
Gregor H. <nomail@[EMA  2007-06-03 00:26:29 
Re: What can I do?
Gregor H. <nomail@[EMA  2007-06-03 00:39:23 
Re: What can I do?
jacob navia <jacob@[EM  2007-06-03 09:06:35 
Re: What can I do?
Gregor H. <nomail@[EMA  2007-06-03 15:29:35 
Re: What can I do?
John Nagle <nagle@[EMA  2007-06-02 15:34:37 
Re: What can I do?
Giorgos Keramidas <ker  2007-06-03 15:33:48 
Re: What can I do?
richard@[EMAIL PROTECTED]  2007-06-02 22:23:21 
Re: What can I do?
jacob navia <jacob@[EM  2007-06-03 09:08:00 
Re: What can I do?
Eric Schmidt <eric4129  2007-06-02 16:54:03 
Re: What can I do?
"Rod Pemberton"  2007-06-02 22:28:28 
Re: What can I do?
richard@[EMAIL PROTECTED]  2007-06-03 15:58:59 
Re: What can I do?
"Rod Pemberton"  2007-06-03 12:43:25 
Re: What can I do?
Hallvard B Furuseth <h  2007-06-03 21:22:48 
Re: What can I do?
Cesar Rabak <csrabak@[  2007-06-03 02:18:53 
Re: What can I do?
Keith Thompson <kst-u@  2007-06-03 00:00:00 
Re: What can I do?
jacob navia <jacob@[EM  2007-06-03 09:15:16 
Re: What can I do?
CBFalconer <cbfalconer  2007-06-03 02:09:14 
Re: What can I do?
Dave Hanson <drhanson@  2007-06-03 14:53:50 
Re: What can I do?
Hallvard B Furuseth <h  2007-06-03 21:44:46 
Re: What can I do?
Keith Thompson <kst-u@  2007-06-03 13:08:36 
Re: What can I do?
"christian.bau"  2007-06-03 14:32:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 6 17:24:03 CDT 2008.