[Bug c/55554] New: GCC generates illegal instruction for optimization level >=O1 when invoking casted pointer to function

2012-12-01 Thread avshabanov at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4



 Bug #: 4

   Summary: GCC generates illegal instruction for optimization

level >=O1 when invoking casted pointer to function

Classification: Unclassified

   Product: gcc

   Version: 4.2.1

Status: UNCONFIRMED

  Severity: major

  Priority: P3

 Component: c

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: avshaba...@gmail.com





Created attachment 28843

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28843

smallest possible program that reproduces an error



The attached program generates an illegal instruction error when compiled on

Mac OS X 10.8.2.



 == GCC info ==

 $ gcc -v

 Using built-in specs.

 Target: i686-apple-darwin11

 Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/src/configure

--disable-checking --enable-werror

--prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2

--mandir=/share/man --enable-languages=c,objc,c++,obj-c++

--program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/

--with-slibdir=/usr/lib --build=i686-apple-darwin11

--enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/dst-llvmCore/Developer/usr/local

--program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11

--target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1

 Thread model: posix

 gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)



 == BUG ==

 To reproduce the bug compile with O1 and higher:

 $ gcc -std=c99 -fomit-frame-pointer -O1 gccbug.c -o gccbug

 $ ./gccbug

 Illegal instruction: 4



 == WORKAROUND ==

 Compile with O0:

 $ gcc -std=c99 -fomit-frame-pointer -O0 -g gccbug.c -o gccbug

 $ ./gccbug

 OK

 OK

 OK

 OK



Please, feel free to contact me if you happen to know *any* (GCC-specific)

workaround for the specified issue.


[Bug c/55554] GCC generates illegal instruction for optimization level >=O1 when invoking casted pointer to function

2012-12-01 Thread avshabanov at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4



--- Comment #1 from Alexander S  2012-12-01 
14:30:19 UTC ---

Created attachment 28844

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28844

Preprocessed output


[Bug c/55554] GCC generates illegal instruction for optimization level >=O1 when invoking casted pointer to function

2012-12-01 Thread avshabanov at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4



Alexander S  changed:



   What|Removed |Added



 Status|UNCONFIRMED |RESOLVED

 Resolution||INVALID



--- Comment #2 from Alexander S  2012-12-01 
15:16:13 UTC ---

Please, close this bug as invalid one, there is an error in source code - table

pointer is not initialized with NULL in main.