This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How I can generate undefined instruction exception in C language

Hi,

How I can write undefined exception Instruction in C language, I tried with instruction MCR but it is not working. Do the needful help.

  • You Can't!

    The whole point of a 'C' compiler is that it generates only valid instructions!!

    Even an assembler will only translate valid source text into object.

    You need to explain what you're actually trying to achieve by this!

  • void undef(void)
    {
        static const int instr = 0x12345678; /* fake undefined opcode */
        ((void(*)(void))&instr)();
    }
    

    But you'll have to come up with a real undefined opcode. 0x12345678 won't do it.