Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1087433 - test-bison-yylval and test-bison-yylloc failed for arch ppc64le
Summary: test-bison-yylval and test-bison-yylloc failed for arch ppc64le
Alias: None
Product: Fedora
Classification: Fedora
Component: flex
Version: 22
Hardware: ppc64le
OS: Linux
Target Milestone: ---
Assignee: Patsy Franklin
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: F-ExcludeArch-ppc64le, PPC64LETracker
TreeView+ depends on / blocked
Reported: 2014-04-14 10:26 UTC by Menanteau Guy
Modified: 2015-11-11 13:59 UTC (History)
3 users (show)

Fixed In Version: flex-2.5.37-5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-11-11 13:59:37 UTC

Attachments (Terms of Use)

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):

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

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 <>
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:

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

Note You need to log in before you can comment on or make changes to this bug.