This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

ss-960426 (w/latest gas+utils) miscompiles bison-generated parser on HPUX 9.0.5


ss-960426
Cygnus' GNU as-960425 (I just noticed there's a newer one and will try that)

In building a test release of bash on an hpux-9.0.5 system,
I found a problem that I traced to what looks like a miscompilation
of part of the bison-generated parser.

I built gcc with --with-gnu-as and CFLAGS=-O2

% as -v
GNU assembler version 960425 (hppa1.1-hp-hpux9.05), using BFD version cygnus-2.6.2
% gcc -v
Reading specs from /data/tcad/hpux/lib/gcc-lib/hppa1.1-hp-hpux9.05/2.7.2-960426/specs
gcc version 2.7.2-960426


% gcc -V 2.7.2-960405 y.tab.c && ./a.out
% gcc -V 2.7.2-960413 y.tab.c && ./a.out
% gcc -V 2.7.2-960419 y.tab.c && ./a.out
Segmentation fault (core dumped)
[Exit 139 (SIGSEGV)]
% gcc -V 2.7.2-960426 y.tab.c && ./a.out
Segmentation fault (core dumped)
[Exit 139 (SIGSEGV)]
% uname -a
HP-UX invader A.09.05 A 9000/735
%

Here's a seriously pared-down y.tab.c.

Jim
===================
static const char yytranslate[] = {
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,    42,    38,    43,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
    16,    17,    18,    19,    20,    21,    22,    23,    34,    25,
    26,    27,    28,    29,    30,    31,    32,    33,    37
};

static const short yyprhs[] = {     0,
     0,     3,     5,     8,    10,    12,    15,    18,    21,    25,
    29,    32,    36,    39,    43,    46,    50,    53,    57,    60,
    64,    67,    71,    74,    78,    81,    85,    88,    92,    95,
    99,   102,   105,   109,   111,   113,   115,   117,   120,   122,
   125,   127,   129,   132,   134,   136,   142,   148,   150,   152,
   154,   156,   158,   165,   172,   180,   188,   199,   210,   217,
   224,   232,   240,   251,   262,   269,   277,   284,   290,   297,
   302,   306,   312,   320,   327,   331,   336,   343,   349,   351,
   354,   359,   364,   370,   376,   379,   383,   385,   389,   392,
   394,   397,   401,   405,   409,   414,   419,   424,   429,   434,
   436,   438,   440,   442,   443,   446,   448,   451,   454,   459,
   464,   468,   472,   474,   476,   479,   482,   486,   490,   495
};

static const short yyrhs[] = {    72,
    36,     0,    36,     0,     1,    36,     0,    37,     0,    20,
     0,    47,    20,     0,    39,    20,     0,    40,    20,     0,
    22,    39,    20,     0,    22,    40,    20,     0,    25,    20,
     0,    22,    25,    20,     0,    26,    20,     0,    22,    26,
    20,     0,    27,    22,     0,    22,    27,    22,     0,    28,
    22,     0,    22,    28,    22,     0,    27,    20,     0,    22,
    27,    20,     0,    28,    20,     0,    22,    28,    20,     0,
    30,    20,     0,    22,    30,    20,     0,    28,    41,     0,
    22,    28,    41,     0,    27,    41,     0,    22,    27,    41,
     0,    31,    20,     0,    22,    32,    20,     0,    32,    20,
     0,    33,    20,     0,    22,    33,    20,     0,    20,     0,
    21,     0,    48,     0,    48,     0,    50,    48,     0,    49,
     0,    51,    49,     0,    51,     0,    53,     0,    53,    50,
     0,    54,     0,    56,     0,    12,    67,    14,    67,    15,
     0,    13,    67,    14,    67,    15,     0,    55,     0,    59,
     0,    58,     0,    60,     0,    57,     0,    10,    20,    71,
    14,    66,    15,     0,    10,    20,    71,    42,    66,    43,
     0,    10,    20,    35,    71,    14,    66,    15,     0,    10,
    20,    35,    71,    42,    66,    43,     0,    10,    20,    71,
    17,    47,    70,    71,    14,    66,    15,     0,    10,    20,
    71,    17,    47,    70,    71,    42,    66,    43,     0,    11,
    20,    71,    14,    66,    15,     0,    11,    20,    71,    42,
    66,    43,     0,    11,    20,    35,    71,    14,    66,    15,
     0,    11,    20,    35,    71,    42,    66,    43,     0,    11,
    20,    71,    17,    47,    70,    71,    14,    66,    15,     0,
    11,    20,    71,    17,    47,    70,    71,    42,    66,    43,
     0,     8,    20,    71,    17,    71,     9,     0,     8,    20,
    71,    17,    64,    71,     9,     0,     8,    20,    71,    17,
    62,     9,     0,    20,    44,    45,    71,    60,     0,    16,
    20,    44,    45,    71,    60,     0,    16,    20,    71,    60,
     0,    44,    67,    45,     0,     3,    67,     4,    67,     7,
     0,     3,    67,     4,    67,     5,    67,     7,     0,     3,
    67,     4,    67,    61,     7,     0,    42,    66,    43,     0,
     6,    67,     4,    67,     0,     6,    67,     4,    67,     5,
    67,     0,     6,    67,     4,    67,    61,     0,    63,     0,
    64,    63,     0,    71,    65,    45,    67,     0,    71,    65,
    45,    71,     0,    71,    44,    65,    45,    67,     0,    71,
    44,    65,    45,    71,     0,    63,    29,     0,    64,    63,
    29,     0,    20,     0,    65,    38,    20,     0,    71,    68,
     0,    66,     0,    71,    69,     0,    69,    36,    71,     0,
    69,    34,    71,     0,    69,    35,    71,     0,    69,    23,
    71,    69,     0,    69,    44,    71,    69,     0,    69,    34,
    71,    69,     0,    69,    35,    71,    69,     0,    69,    36,
    71,    69,     0,    74,     0,    36,     0,    35,     0,    37,
     0,     0,    71,    36,     0,    73,     0,    73,    34,     0,
    73,    35,     0,    73,    23,    71,    73,     0,    73,    54,
    71,    73,     0,    73,    34,    73,     0,    73,    35,    73,
     0,    74,     0,    75,     0,    18,    75,     0,    19,    75,
     0,    19,    18,    75,     0,    18,    19,    75,     0,    75,
    38,    71,    75,     0,    52,     0
};

static const short yyrline[] = { 0,
   197,   206,   213,   229,   239,   241,   245,   250,   255,   260,
   265,   270,   275,   281,   287,   292,   297,   302,   307,   312,
   317,   322,   327,   334,   341,   346,   351,   356,   361,   366,
   371,   376,   381,   388,   390,   392,   396,   400,   411,   413,
   417,   419,   421,   450,   452,   454,   456,   458,   460,   462,
   464,   466,   470,   472,   474,   476,   478,   480,   484,   488,
   492,   496,   500,   504,   510,   512,   514,   518,   522,   525,
   529,   533,   535,   537,   542,   546,   548,   550,   554,   555,
   559,   561,   563,   565,   569,   570,   574,   576,   585,   593,
   594,   600,   601,   608,   612,   614,   616,   623,   625,   627,
   631,   632,   633,   636,   637,   646,   652,   661,   669,   671,
   673,   680,   683,   687,   689,   694,   699,   704,   711,   714
};

static const char * const yytname[] = {   "$","error","$undefined.","IF","THEN",
"ELSE","ELIF","FI","CASE","ESAC","FOR","SELECT","WHILE","UNTIL","DO","DONE",
"FUNCTION","IN","BANG","TIME","WORD","ASSIGNMENT_WORD","NUMBER","AND_AND","OR_OR",
"GREATER_GREATER","LESS_LESS","LESS_AND","GREATER_AND","SEMI_SEMI","LESS_LESS_MINUS",
"AND_GREATER","LESS_GREATER","GREATER_BAR","'&'","';'","'\\n'","yacc_EOF","'|'",
"'>'","'<'","'-'","'{'","'}'","'('","')'","inputunit","word_list","redirection",
"simple_command_element","redirection_list","simple_command","command","shell_command",
"for_command","select_command","case_command","function_def","subshell","if_command",
"group_command","elif_clause","case_clause","pattern_list","case_clause_sequence",
"pattern","list","compound_list","list0","list1","list_terminator","newline_list",
"simple_list","simple_list1","pipeline_command","pipeline",""
};

static const short yyr1[] = {     0,
    46,    46,    46,    46,    47,    47,    48,    48,    48,    48,
    48,    48,    48,    48,    48,    48,    48,    48,    48,    48,
    48,    48,    48,    48,    48,    48,    48,    48,    48,    48,
    48,    48,    48,    49,    49,    49,    50,    50,    51,    51,
    52,    52,    52,    53,    53,    53,    53,    53,    53,    53,
    53,    53,    54,    54,    54,    54,    54,    54,    55,    55,
    55,    55,    55,    55,    56,    56,    56,    57,    57,    57,
    58,    59,    59,    59,    60,    61,    61,    61,    62,    62,
    63,    63,    63,    63,    64,    64,    65,    65,    66,    67,
    67,    68,    68,    68,    69,    69,    69,    69,    69,    69,
    70,    70,    70,    71,    71,    72,    72,    72,    73,    73,
    73,    73,    73,    74,    74,    74,    74,    74,    75,    75
};

static const short yyr2[] = {     0,
     2,     1,     2,     1,     1,     2,     2,     2,     3,     3,
     2,     3,     2,     3,     2,     3,     2,     3,     2,     3,
     2,     3,     2,     3,     2,     3,     2,     3,     2,     3,
     2,     2,     3,     1,     1,     1,     1,     2,     1,     2,
     1,     1,     2,     1,     1,     5,     5,     1,     1,     1,
     1,     1,     6,     6,     7,     7,    10,    10,     6,     6,
     7,     7,    10,    10,     6,     7,     6,     5,     6,     4,
     3,     5,     7,     6,     3,     4,     6,     5,     1,     2,
     4,     4,     5,     5,     2,     3,     1,     3,     2,     1,
     2,     3,     3,     3,     4,     4,     4,     4,     4,     1,
     1,     1,     1,     0,     2,     1,     2,     2,     4,     4,
     3,     3,     1,     1,     2,     2,     3,     3,     4,     1
};

static const short yydefact[] = {     0,
     0,   104,     0,     0,     0,   104,   104,     0,     0,     0,
    34,    35,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     2,     4,     0,     0,   104,   104,    36,    39,    41,
   120,    42,    44,    48,    45,    52,    50,    49,    51,     0,
   106,   113,   114,     3,    90,     0,     0,   104,   104,   104,
     0,     0,   104,     0,   115,     0,   116,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,    11,    13,    19,
    15,    27,    21,    17,    25,    23,    29,    31,    32,     7,
     8,     0,     0,     0,    34,    40,    37,    43,     1,   104,
   104,   107,   108,   104,   104,   105,    89,    91,   100,     0,
   104,     0,   104,     0,   104,   104,     0,     0,   118,   117,
   104,    12,    14,    20,    16,    28,    22,    18,    26,    64,
    30,    33,     9,    10,    75,     0,    71,    38,     0,     0,
   111,   112,     0,     0,   104,   104,   104,   104,   104,   104,
     0,   104,     0,   104,     0,   104,     0,   104,     0,     0,
   104,    70,     0,   109,   110,     0,     0,   119,   104,   104,
    72,     0,     0,     0,    93,    94,    92,     0,    79,   104,
     0,   104,   104,     0,     5,     0,     0,   104,   104,     0,
     0,     0,    46,    47,     0,    68,     0,     0,    74,    95,
    96,    97,    98,    99,    67,    85,    80,     0,    65,    87,
     0,     0,     0,     0,    53,     6,   102,   101,   103,   104,
    54,     0,     0,    59,   104,    60,    69,    73,   104,   104,
   104,   104,    86,    66,     0,     0,   104,    55,    56,     0,
    61,    62,     0,    76,     0,     0,     0,   104,    88,    81,
    82,   104,   104,   104,   104,   104,    78,    83,    84,     0,
     0,     0,     0,    77,    57,    58,    63,    64,     0,     0,
     0
};

static const short yydefgoto[] = {   259,
   176,    28,    29,    88,    30,    31,    32,    33,    34,    35,
    36,    37,    38,    39,   162,   168,   169,   170,   202,    45,
    46,    97,    98,   210,    83,    40,   131,    99,    43
};

static const short yypact[] = {   246,
   -34,     0,   -14,     7,    12,     0,     0,    15,   351,   386,
   -26,     0,    92,    20,    34,    46,    54,    47,    70,    71,
    74,     0,     0,    76,    96,     0,     0,     0,     0,   170,
     0,   477,     0,     0,     0,     0,     0,     0,     0,    87,
   106,     0,    11,     0,     0,   140,   281,     0,   110,   116,
   139,   141,   115,   456,    11,   456,    11,   122,   146,   151,
    57,    80,   152,   153,   155,   156,   157,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,   117,   281,   133,     0,     0,     0,   477,     0,     0,
     0,   316,   316,     0,     0,     0,     0,   -12,     0,     3,
     0,    19,     0,    27,     0,     0,   134,    36,    11,    11,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,   -12,     0,     0,   281,   281,
    59,    59,   421,   121,     0,     0,     0,     0,     0,     0,
    14,     0,   162,     0,    28,     0,   162,     0,   173,   174,
     0,     0,    36,     0,     0,   316,   316,    11,     0,     0,
     0,   186,   281,   281,   281,   281,   281,   185,   175,     0,
    -6,     0,     0,   184,     0,   128,   163,     0,     0,   190,
   128,   164,     0,     0,    36,     0,   204,   208,     0,     0,
     0,    62,    62,    62,     0,     0,   187,     1,     0,     0,
   194,   -19,   200,   179,     0,     0,     0,     0,     0,     0,
     0,   209,   180,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,    35,   206,     0,     0,     0,    29,
     0,     0,    39,    53,   281,   281,   281,     0,     0,     0,
   281,     0,     0,     0,     0,     0,     0,     0,   281,   212,
   188,   213,   189,     0,     0,     0,     0,     0,   230,   233,
     0
};

static const short yypgoto[] = {-32768,
    88,   -31,   207,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,  -101,     0,-32768,    68,-32768,    38,     8,
     2,-32768,   -52,    60,    -2,-32768,    17,    13,     6
};

static const short yytable[] = {    47,
    87,    44,   199,    47,    47,    48,   152,    51,    52,   224,
   135,   136,    42,   200,    55,    57,    41,    58,   226,   140,
   200,   137,   138,   139,    47,   227,    49,   172,    84,    96,
   126,    50,   142,    82,    53,   143,    96,   201,    96,    68,
   146,   178,   242,   147,   201,   100,   102,   104,    94,    96,
   108,   186,   244,    69,    96,   173,   128,   246,   160,   109,
   144,   110,    96,    96,    96,    70,    76,    71,   148,   179,
   243,    96,   226,    73,    96,    74,   114,    26,   115,   238,
   245,    90,    91,   217,   135,   136,    72,   129,   130,    77,
    78,   133,    47,    79,    75,    80,   134,   116,   141,   117,
   145,   118,    47,    47,    42,    42,   149,   150,   153,   132,
   190,   191,   192,   193,   194,    81,    59,    60,    61,    62,
   119,    63,    89,    64,    65,   159,   160,   161,    90,    91,
    66,    67,   163,   164,   165,   166,   167,   171,   158,    92,
    93,    42,    42,    95,   101,   154,   155,   206,   185,   174,
   103,   177,   105,   180,   106,   182,    47,    47,   107,   125,
   187,   188,   207,   208,   209,   112,   111,   198,    42,    42,
   113,   120,   121,   132,   122,   123,   124,   127,   151,   203,
   204,   175,   192,   193,   194,   212,   213,   183,   184,    85,
    12,    13,   189,   195,    14,    15,    16,    17,   205,    18,
    19,    20,    21,   196,   214,   211,   216,   230,    74,    25,
   218,   219,   233,   200,   228,   223,    47,   235,   236,   237,
   234,   229,   232,   231,   241,   239,   255,   257,   240,   260,
   256,   258,   261,   247,   181,   249,    86,   197,   225,   248,
   215,     0,     0,    47,     0,     0,     1,   254,     2,   250,
   251,   252,   253,     3,     0,     4,     5,     6,     7,     0,
     0,     8,     0,     9,    10,    11,    12,    13,     0,     0,
    14,    15,    16,    17,     0,    18,    19,    20,    21,     0,
     0,    22,    23,     2,    84,    25,     0,    26,     3,    27,
     4,     5,     6,     7,     0,     0,     8,     0,     9,    10,
    11,    12,    13,     0,     0,    14,    15,    16,    17,     0,
    18,    19,    20,    21,     0,     0,    96,     0,     2,    94,
    25,     0,    26,     3,    27,     4,     5,     6,     7,     0,
     0,     8,     0,     9,    10,    11,    12,    13,     0,     0,
    14,    15,    16,    17,     0,    18,    19,    20,    21,     0,
     0,     0,     0,     2,    104,    25,     0,    26,     3,    27,
     4,     5,     6,     7,     0,     0,     8,     0,     0,    54,
    11,    12,    13,     0,     0,    14,    15,    16,    17,     0,
    18,    19,    20,    21,     0,     0,     0,     0,     2,    114,
    25,     0,    26,     3,    27,     4,     5,     6,     7,     0,
     0,     8,     0,    56,     0,    11,    12,    13,     0,     0,
    14,    15,    16,    17,     0,    18,    19,    20,    21,     0,
     0,     0,     0,     2,    124,    25,     0,    26,     3,    27,
     4,     5,     6,     7,     0,     0,     8,     0,     0,     0,
    11,    12,    13,     0,     0,    14,    15,    16,    17,     0,
    18,    19,    20,    21,     0,     0,    96,     0,     2,    134,
    25,     0,    26,     3,    27,     4,     5,     6,     7,     0,
     0,     8,     0,     0,     0,    11,    12,    13,     0,     0,
    14,    15,    16,    17,     0,    18,    19,    20,    21,     0,
     0,     0,     0,     0,    144,    25,     0,    26,    13,    27,
     0,    14,    15,    16,    17,     0,    18,    19,    20,    21,
     0,     0,     0,     0,     0,    154,    25
};

static const short yycheck[] = {     2,
    32,    36,     9,     6,     7,    20,   108,     6,     7,     9,
    23,    164,     0,    20,     9,    10,     0,    44,    38,    17,
    20,    34,    35,    36,    27,    45,    20,    14,    27,    36,
    83,    20,    14,    26,    20,    17,    36,    44,    36,    20,
    14,    14,    14,    17,    44,    48,    49,    50,    38,    36,
    53,   153,    14,    20,    36,    42,    88,     5,     6,    54,
    42,    56,    36,    36,    36,    20,    20,    22,    42,    42,
    42,    36,    38,    20,    36,    22,    20,    42,    22,    45,
    42,    23,    -124,   185,    23,    -224,    41,    90,    91,    20,
    20,    94,    95,    20,    41,    20,    95,    41,   101,    20,
   103,    22,   105,   106,    92,    93,   105,   106,   111,    93,
   163,   164,   165,   166,   167,    20,    25,    26,    27,    28,
    41,    30,    36,    32,    33,     5,     6,     7,    23,    -324,
    39,    40,   135,   136,   137,   138,   139,   140,   133,    34,
    35,   129,   130,     4,    35,   129,   130,    20,   151,   142,
    35,   144,    14,   146,    14,   148,   159,   160,    44,    43,
   159,   160,    35,    36,    37,    20,    45,   170,   156,   157,
    20,    20,    20,   157,    20,    20,    20,    45,    45,   172,
   173,    20,   235,   236,   237,   178,   179,    15,    15,    20,
    21,    22,     7,     9,    25,    26,    27,    28,    15,    30,
    31,    32,    33,    29,    15,    43,    43,   210,    39,    40,
     7,     4,   215,    20,    15,    29,   219,   220,   221,   222,
   219,    43,    43,    15,   227,    20,    15,    15,   227,     0,
    43,    43,     0,   234,   147,   238,    30,   170,   201,   238,
   181,    -1,    -1,   246,    -1,    -1,     1,   246,     3,   242,
   243,   244,   245,     8,    -1,    10,    11,    12,    13,    -1,
    -1,    16,    -1,    18,    19,    20,    21,    22,    -1,    -1,
    25,    26,    27,    28,    -1,    30,    31,    32,    33,    -1,
    -1,    36,    37,     3,    39,    40,    -1,    42,     8,    44,
    10,    11,    12,    13,    -1,    -1,    16,    -1,    18,    19,
    20,    21,    22,    -1,    -1,    25,    26,    27,    28,    -1,
    30,    31,    32,    33,    -1,    -1,    36,    -1,     3,    39,
    40,    -1,    42,     8,    44,    10,    11,    12,    13,    -1,
    -1,    16,    -1,    18,    19,    20,    21,    22,    -1,    -1,
    25,    26,    27,    28,    -1,    30,    31,    32,    33,    -1,
    -1,    -1,    -1,     3,    39,    40,    -1,    42,     8,    44,
    10,    11,    12,    13,    -1,    -1,    16,    -1,    -1,    19,
    20,    21,    22,    -1,    -1,    25,    26,    27,    28,    -1,
    30,    31,    32,    33,    -1,    -1,    -1,    -1,     3,    39,
    40,    -1,    42,     8,    44,    10,    11,    12,    13,    -1,
    -1,    16,    -1,    18,    -1,    20,    21,    22,    -1,    -1,
    25,    26,    27,    28,    -1,    30,    31,    32,    33,    -1,
    -1,    -1,    -1,     3,    39,    40,    -1,    42,     8,    44,
    10,    11,    12,    13,    -1,    -1,    16,    -1,    -1,    -1,
    20,    21,    22,    -1,    -1,    25,    26,    27,    28,    -1,
    30,    31,    32,    33,    -1,    -1,    36,    -1,     3,    39,
    40,    -1,    42,     8,    44,    10,    11,    12,    13,    -1,
    -1,    16,    -1,    -1,    -1,    20,    21,    22,    -1,    -1,
    25,    26,    27,    28,    -1,    30,    31,    32,    33,    -1,
    -1,    -1,    -1,    -1,    39,    40,    -1,    42,    22,    44,
    -1,    25,    26,    27,    28,    -1,    30,    31,    32,    33,
    -1,    -1,    -1,    -1,    -1,    39,    40
};

int
main()
{
  int yyn = 53;

  if (yypgoto[yyn - 53] != yypgoto[0])
    abort();
  exit (0);
}