Package: bison Version: A2.6-12 The following input file (which contains errors, I know :-) causes bison to dump core.
I have no idea wether this is a libc or a bison error. Gdb tells me the following: $ gdb /usr/bin/bison core GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is absolutely no warranty for GDB; type "show warranty" for details. GDB 4.15.1 (i486-linux), Copyright 1995 Free Software Foundation, Inc... (no debugging symbols found)... Core was generated by `bison crash.y'. Program terminated with signal 11, Segmentation fault. Reading symbols from /lib/libc.so.5.2.18...(no debugging symbols found)...done. Reading symbols from /lib/ld-linux.so.1...(no debugging symbols found)...done. #0 0x4003c567 in malloc () Here's the input file (called crash.y): %{ #include <time.h> #define YYDEBUG 1 time_t currtime; struct tm currtm; struct tm exectm; %} %union { struct tm tmstruct; time_t timet; int intval; } %token INT %token NOW %token TIMEZONE_NAME %token AM PM %token NOON MIDNIGHT TEATIME %token SUN MON TUE WED THU FRI SAT %token TODAY TOMORROW %token NEXT %token MINUTE HOUR DAY WEEK MONTH YEAR %token JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC %token WORD %type <intval> inc_period %start timespec %% timespec : time | time date | time increment | time date increment | time decrement | time date decrement | nowspec ; nowspec : now | now increment | now decrement ; now: : NOW ; time : hr24clock_hr_min | hr24clock_hr_min timezone_name | hr24clock_hour time_sep minute | hr24clock_hour time_sep minute timezone_name | hr24clock_hour am_pm | hr24clock_hour am_pm timezone_name | hr24clock_hour time_sep minute am_pm | hr24clock_hour time_sep minute am_pm timezone_name | NOON | MIDNIGHT | TEATIME ; date : month_name day_number | month_name day_number ',' year_number | day_of_week | TODAY | TOMORROW ; increment : '+' inc_number inc_period { switch($3) { case MINUTE: exectm.tm_min break; default: yyerror("Internal parser error"); YYERROR; } } | NEXT inc_period ; decrement : '-' inc_number inc_period ; inc_period : MINUTE { $$ = MINUTE ; } | HOUR { $$ = HOUR ; } | DAY { $$ = DAY ; } | WEEK { $$ = WEEK ; } | MONTH { $$ = MONTH ; } | YEAR { $$ = YEAR ; } ; hr24clock_hr_min: INT ; timezone_name : TIMEZONE_NAME ; hr24clock_hour : INT ; minute : INT ; am_pm : AM | PM ; month_name : JAN | FEB | MAR | APR | MAY | JUN | JUL | AUG | SEP | OCT | NOV | DEC ; day_number : INT ; year_number : INT ; day_of_week : SUN | MON | TUE | WED | THU | FRI | SAT ; inc_number : INT ; time_sep : ':' | '\'' | '.' | 'h' | ',' ; %% #include "mydate.h" time_t parsetime(int, char **); int main(int argc, char **argv) { #ifdef YYDEBUG yydebug = 1; #endif currtime = time(NULL); currtm = *localtime(&currtime); yyparse(); } int yyerror(char *s) { fprintf(stderr,"%s. Last token seen: %s\n",s, last_token); return 0; }