Hello, `yylex' is probably trying to read from an invalid address. That would explain the segmentation fault.
Have you set the input source properly, i.e., with `yyset_in', `yyrestart', `yy_scan_string' or some other function? Laurence Finston ________________________________________ From: help-bison-bounces+laurence.finston=gwdg...@gnu.org [help-bison-bounces+laurence.finston=gwdg...@gnu.org] on behalf of Gautam Kapoor [gkap...@cadence.com] Sent: Thursday, May 30, 2013 9:03 AM To: Charlie Lacroix; help-bison@gnu.org Subject: RE: SegFault on yyparse() Hi Charlie, YYLEX is a macro. It is making a call to the scanner to get the next token. I don't think "assigning to yychar" is causing the segfault. Please put a breakpoint into yylex() function and see where it is crashing. Let us see the code snippet inside yylex() function to make out why the error occurs. In a newer version of bison/flex, and depending on my other flags, I see this: /* Read a lookahead token. */ if (yychar == yyempty_) { YYCDEBUG << "Reading a token: "; yychar = yylex (&yylval, &yylloc); } -regards Gautam -----Original Message----- From: help-bison-bounces+gkapoor=cadence....@gnu.org [mailto:help-bison-bounces+gkapoor=cadence....@gnu.org] On Behalf Of Charlie Lacroix Sent: Wednesday, May 29, 2013 1:18 PM To: help-bison@gnu.org Subject: SegFault on yyparse() Hi, I am a beginner with Flex/Bison tools. At my work, we have a project, which contains bison files. It is an old version of bison : 2.3 ; and an old version of Flex : 2.5.4. It compiles on this version, but on my personal computer (with one of the last version of bison and flex), I have a segmentation fault. I used gdb to understand why, and the segfault appears on yyparse in bla.tab.c, on the line below : if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); --> yychar = YYLEX; } I really don't understand why it works at my work, and not on my computer... Can somebody help me? (sorry if I do not speak very well, I am a french ^^') Thanks! Best regards Charlie Lacroix _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison