"illegal instruction" in juce_MathFunctions


#1

I’m getting an “illegal instruction” crash/exception at

const float float_pi = (float) double_pi;

(excuse typos: writing from memory here - on lunch)

on an older AMD machine. it’s wierd because we have three apps, only one of which does not crash as above.

it’s not a big deal as I’ll probably get told not to waste time getting it working! but I’m curious.

am I barking up the right tree blaming the processor?

what would cause a JUCEApplication to NOT load the maths functions? that might explain our one working app.

any knowledge on this much appreciated!


#2

That’s seriously weird… Surely the compiler should have optimised that line out anyway??

What if you change it to explicitly say:

const float float_Pi = (float) 3.1415926535897932384626433832795;

?


#3

Illegal instruction sounds like the cpu gets instructed to do something it can’t do. (Like a bit trunc of a double.)
Are you sure you haven’t compiled it with some optimization option that the AMD doesn’t support?


#4

[quote=“jules”]That’s seriously weird… Surely the compiler should have optimised that line out anyway??

What if you change it to explicitly say:

const float float_Pi = (float) 3.1415926535897932384626433832795;

?[/quote]

same.

the surrounding code for this exception is in crt0dat.c in function _initterm.

if that means anything to anyone!

Been looking at my settings. SSE stuff (ARCH) is “not set” and linkers MACHINE is X86.

so can’t yet find any settings difference between my working app and the knackered ones.

I usually stick to the same settings as JUCE anyway.

there must be something in there somewhere though as one app is initialising fine.


#5

[quote=“Karbon L. Forms”][quote=“jules”]That’s seriously weird… Surely the compiler should have optimised that line out anyway??

What if you change it to explicitly say:

const float float_Pi = (float) 3.1415926535897932384626433832795;

?[/quote]

same.

the surrounding code for this exception is in crt0dat.c in function _initterm.

if that means anything to anyone!

Been looking at my settings. SSE stuff (ARCH) is “not set” and linkers MACHINE is X86.

so can’t yet find any settings difference between my working app and the knackered ones.

I usually stick to the same settings as JUCE anyway.

there must be something in there somewhere though as one app is initialising fine.[/quote]

my mistake, got my JUCE libs confused. that did solve it. but only until it ran into this, in my code…

double a_double = (double) 44100;

it don like casting doubles. well spooky.

Im stumped.


#6