Comment 13 for bug 615953

Revision history for this message
In , Matthew (matthew-redhat-bugs) wrote :

Description of problem:
compiling a minimal test application statically using gcc, the call strspn() causes a SIGILL. Prints "Illegal instruction" on the command line.

Changing "char var[]" to "char *var" for strtext and cset causes the problem to decrease from always occuring despite optimization level to occuring only during -O0.

Does not occur for dynamically linked application.

Version-Release number of selected component (if applicable):
glibc-static-2.12-3

How reproducible:
Every time.

Steps to Reproduce:
1. Compile main.c below (strspn test) with "gcc main.c -g -static -O0 -o testapp.bin"
2. Run ./testapp.bin
3. Run gdb ./testapp.bin

Actual results:
When ran from the command line, output is "Illegal instruction"
When ran from the debugger, output is
Program received signal SIGILL, Illegal instruction.
0x08052f5d in __strspn_sse42 ()

Expected results:
Prints-"The length of initial number is 3."

Additional info:
#######main.c############
#include <stdio.h>
#include <string.h>

int main (int argc, char *argv[]){
   char strtext[] = "129th";
   char cset[] = "1234567890";
   int i;

   i = strspn( strtext, cset );
   printf ( "The length of initial number is %d.\n", i );

   return 0;
}
#########################