El lun., 26 nov. 2018 a las 15:50, Segher Boessenkool (<segher@xxxxxxxxxxxxxxxxxxx>) escribió: > > Hi, > > On Mon, Nov 26, 2018 at 12:27:38PM +0100, Thomas De Schampheleire wrote: > > El mié., 21 nov. 2018 a las 15:46, Thomas De Schampheleire > > (<patrickdepinguin@xxxxxxxxx>) escribió: > > Modified code is: > > > > if( fg & MEM_Int ){ > > sqlite3_snprintf(nByte, pMem->z, "%lld", pMem->u.i); > > }else{ > > assert( fg & MEM_Real ); > > asm volatile("" ::: "memory"); > > sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->u.r); > > } > > > > My question now becomes: is gcc allowed to optimize here (without the barrier)? > > Is gcc allowed to pre-load the floating point value pMem->u.r if it > > does not know yet that the value in the union is a floating-point > > value, knowing that a load of an invalid (integer) value could cause > > floating-point exceptions like underflow? > > It depends on many things. We need to have some full, compilable source > code; know which target exactly; exact compiler flags used; what you saw > happen and why you think that is wrong. And then file it on > https://gcc.gnu.org/bugzilla please. > Thanks, I posted at: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88240