GCC48/49 crash on fast floating point math in combination with -O3

2014-10-24 Thread Hans Petter Selasky
Hi, Looks like one of the -O3 optimising steps are broken: cat << EOF > powfcrash.cpp #include #include class test { public: unsigned char y; void testfn(unsigned char); }; void test :: testfn(unsigned char x) { y = x; float fr = expf(powf(y / 127.0f, 0.5f) *

Question about how switch statements are implemented

2007-11-24 Thread Hans Petter Selasky
Hi, In simple cases like linear sequences, will the GCC compiler make a jump table? switch (x) { case 0: case 1: case 2: case 3: } In all other cases where a jump table is not applicable, will the GCC compiler sort the values and do a binary search? switch (x) { case 1: case 256: case 65536:

Re: GCC has problems with 64-bit multiplication

2007-02-26 Thread Hans Petter Selasky
On Thursday 08 February 2007 16:02, Graham Stott wrote: > All, > > Not a bug in GCC the result is correct as you've only asked for a 32-bit > multiply. Hi again, The problem was not that "mull" is used, but that "gcc 3.4.6" generates highly un-optimized code when I for example multiply a 16-bit

Re: GCC has problems with 64-bit multiplication

2007-02-08 Thread Hans Petter Selasky
iplication, and not all ? Or something similar ? > > --- Hans Petter Selasky <[EMAIL PROTECTED]> wrote: > > Test program: > > > > #include > > #include > > > > int main() { > > > > int32_t a = 0x4000; > > int16_t b =

GCC has problems with 64-bit multiplication

2007-02-08 Thread Hans Petter Selasky
Test program: #include #include int main() { int32_t a = 0x4000; int16_t b = 0x4000; int64_t c = a * b; printf("0x%016llx\n", c); return 0; } %cc test.c %./a.out 0x %gcc --version gcc (GCC) 3.4.6 [FreeBSD] 20060305 Copyright