Description of problem: make check of flex in arch ppc64le triggers a segmentation fault on test-bison-yylval and test-bison-yylloc Version-Release number of selected component (if applicable): flex-2.5.37-4.fc21.ppc64le bison-3.0.2-1.fc21.ppc64le How reproducible: rpmbuild --target ppc64le (with make check enabled) or make check or ./test-bison-yylval < ./test.input Actual results: gcc -c -o scanner.o -I. -I../.. -I../.. -I. -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 scanner.c scanner.c:2899:16: warning: 'input' defined but not used [-Wunused-function] static int input (yyscan_t yyscanner) ^ gcc -c -o main.o -I. -I../.. -I../.. -I. -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 main.c gcc -o test-bison-yylval -Wl,-z,relro parser.o scanner.o main.o ./test-bison-yylval < ./test.input /bin/sh: line 1: 6658 Segmentation fault ./test-bison-yylval < ./test.input make[5]: *** [test] Error 139 Results: Tests succeeded: 44 Tests FAILED: 2 Additional info: investigating test-bison-yylval with gdb gives: -bash-4.3# gdb --args test-bison-yylval GNU gdb (GDB) Fedora 7.7-4.fc21 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "ppc64le-redhat-linux-gnu". ... Reading symbols from test-bison-yylval...done. (gdb) run < test.input Starting program: /home/root/rpmbuild/BUILD/flex-2.5.37/tests/test-bison-yylval/test-bison-yylval < test.input Program received signal SIGSEGV, Segmentation fault. testlex (yylval_param=0x3fffffffe7b0, yyscanner=0x1ffffff247b0) at scanner.c:2412 2412 yylval = yylval_param; Missing separate debuginfos, use: debuginfo-install glibc-2.18.90-12.1.2.fc21.ppc64le (gdb) backtrace #0 testlex (yylval_param=0x3fffffffe7b0, yyscanner=0x1ffffff247b0) at scanner.c:2412 #1 0x00000000100016d8 in testparse (scanner=0x10030010) at parser.c:1157 #2 0x0000000010000a0c in main (argc=<optimized out>, argv=<optimized out>) at main.c:33 after closer investigation on code I saw that yylval_param have been passed as parametre to yylex (or testlex) function of scaneer.c. in generated code scanner.c, testlex is defined as follow: extern int testlex \ (YYSTYPE * yylval_param ,yyscan_t yyscanner); int testlex \ (YYSTYPE * yylval_param , yyscan_t yyscanner) { register yy_state_type yy_current_state; Unfortunatly, yylex is called from generated code parser.c with only one parameter instead of two. yylex is called in following manner: /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (&yylval); } I am not a specialist of bison or flex and I didn't find if a parameter could be change in parser.y or scanner.l to correct the problem but changing the generated code parser.c by adding the second parameter at the call, yychar = yylex (&yylval, scanner); make the test succeed.
make check of flex in arch ppc64le of flex-2.5.37-5.fc21.src.rpm passed successfully.
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle. Changing version to '22'. More information and reason for this action is here: https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22
Here is the reason: http://sourceforge.net/p/flex/bugs/169/ Here is the fix: http://sourceforge.net/p/flex/bugs/169/attachment/0001-bison-test-fixes-Do-not-use-obsolete-bison-construct.patch //Hongxu
This was fixed in Fedora 21, and as a result is also fixed in F22 and rawhide.