tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Re: global 64-bit variables initialization


From: Masha Rabinovich
Subject: Re: [Tinycc-devel] Re: global 64-bit variables initialization
Date: Fri, 21 Nov 2008 00:31:57 +0100

The was not 1000000000 in the program I am trying to compile with tcc, but there was pointer + some small value in constant _expression_. the only reason I put 1000000000 in test case was to see in output a value different from regular pointer to be sure the additional is performed.

Something like

====

char hello[]="hello";
char*hello10=hello+10;

====

were a more correct testcase for constant pointer ariphmetic.

Sorry for that.

And thank you for your work!

On Thu, Nov 20, 2008 at 11:49 PM, Daniel Glöckner <address@hidden> wrote:

On Thu, Nov 20, 2008 at 07:42:59PM +0100, Masha Rabinovich wrote:
>  main ? 0 : 1, // function pointer is always true

Done.

>  (int)main + (int)1e9, // be sure the result is above 1.000.000.000

I removed the error message again. It was wrong in several ways.

There is no need for the _expression_ to evaluate to a value > 1000000000.
(int)main may be negative.

Actually I'm not convinced that these two casts must be supported outside
of functions. Section 6.6 in C99 draft N869 does not talk about casting
address constants to integers. It does allow implemetations to accept
other constant expressions, though.

>  (int)main / 2, // here must be compile-time error, tcc can compile it
>  sin(1) ? 0 : 1, // here must be compile-time error, tcc can compile it

I don't think we should add checks for all variants of invalid code.
IMHO the main focus should be on correctly compiling valid code.
Otherwise we'll soon have a not so tiny TinyCC.

 Daniel


_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel



reply via email to

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