As of commit 7666f806, casting an int to a float fails:

rosuav@sikorsky:~/pike$ bin/pike
Pike v8.0 release 3 running Hilfe v3.5 (Incremental Pike Frontend)
> (float)1;
Cast failed, wanted float, got int
HilfeInput:1: HilfeInput()->___HilfeWrapper()

This happens also on any arithmetic operation that mixes int and
float, which does an equivalent cast implicitly. Fiddling around with
the corresponding code suggests it may be connected to the GCC warning
that also comes up:

warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]

In SET_SVAL, two pointers to the same object with different types are
used. I think this violates the C standard, which is why sometimes
stuff isn't getting correctly written out - something's getting
optimized away. Is there a way to do the same job with a union inside
struct svalue, instead of the pointer casts? Or alternatively, can the
compiler be told not to optimize this out?

ChrisA
  • Cas... Chris Angelico
    • ... Per Hedbor () @ Pike (-) developers forum
    • ... Chris Angelico
      • ... Chris Angelico
        • ... Arne Goedeke
          • ... Arne Goedeke
            • ... Per Hedbor () @ Pike (-) developers forum
              • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
            • ... Henrik Grubbström (Lysator) @ Pike (-) developers forum

Reply via email to