Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1087433

Summary: test-bison-yylval and test-bison-yylloc failed for arch ppc64le
Product: [Fedora] Fedora Reporter: Menanteau Guy <menantea>
Component: flexAssignee: Patsy Griffin <pfrankli>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: hongxu.jia, mnewsome, pfrankli
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: flex-2.5.37-5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-11 13:59:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1051573    

Description Menanteau Guy 2014-04-14 10:26:25 UTC
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.

Comment 1 Menanteau Guy 2014-05-21 11:59:40 UTC
make check of flex in arch ppc64le of flex-2.5.37-5.fc21.src.rpm passed successfully.

Comment 2 Jaroslav Reznik 2015-03-03 17:12:42 UTC
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

Comment 4 Patsy Griffin 2015-11-11 13:59:37 UTC
This was fixed in Fedora 21, and as a result is also fixed in F22 and rawhide.