[Solved] Error getting ptr on variable inside exception filter with -Ot/-Os/-Ox

Started by iZzz32, June 23, 2010, 08:20:42 PM

Previous topic - Next topic

iZzz32

Maybe I've already reported it, but anyway... POCC 6.00.6 fails to compile the following code:
#include <windows.h>
#include <stdio.h>

DWORD exception_filter(int* k)
{
 return EXCEPTION_EXECUTE_HANDLER;
}

int main(void)
{
 int               foo;
 int *             bar;

 // bar = &foo;

 __try
 {
   *(DWORD *) 0 = 0xdeadbeef;
 }
 __except(exception_filter(&foo))
 {
   printf("Exception!\n");
 }
 return 0;
}

C:\>pocc -Ze -Ot test.c says:
test.c(12): warning #2114: Local 'bar' is not referenced.
test.c(19): error #3151: [asm] Syntax error.
test.c(19): error #3152: [asm] Expected ')'.
test.c(19): error #3152: [asm] Expected ']'.
test.c(19): error #3151: [asm] Syntax error.

It compiles when I uncomment an assignment to bar or without -Ot/-Os/-Ox. IIRC, the same code compiles without errors in 4.50 (with and without optimizations) too.