[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] -__inf__ and -__nan__ are not constant
From: |
grischka |
Subject: |
Re: [Tinycc-devel] -__inf__ and -__nan__ are not constant |
Date: |
Wed, 26 Jul 2023 12:28:09 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 6.0; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 23.07.2023 16:11, wizzwizz4 via Tinycc-devel wrote:
I tried compiling QuickJS with tcc.
After setting `-DEMSCRIPTEN -DCONFIG_VERSION=""`, I get:
quickjs.c:2664: warning: function might return no value: 'JS_AtomGetKind'
quickjs.c:39834: error: initializer element is not constant
I'm guessing the error has something to do with this:
See tccgen.c:2491:
/* NOTE: we only do constant propagation if finite number (not
NaN or infinity) (ANSI spec) */
Not necessarily saying that this is what tcc is actually doing and/or
should do....
-- gr
$ tcc -run -
a = { 1e1000 };
b = { -1e54 };
c = { __inf__ };
d = { +__inf__ };
e = { -1.0 / 0.0 };
f = { -__inf__ };
-:6: error: initializer element is not constant
For some reason, -__inf__ isn't considered a constexpr.
Neither is -1e320, or -__nan__.
Negating other float values, or not negating these ones, is fine.
(Reader note: __inf__ and __nan__ are TCC implementation details;
in real programs, INFINITY and NAN from <math.h> should be used
instead.)
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel