diff mbox

[GIMPLEFE] Fix for ICE due to undeclared variable

Message ID CAE+uiWZJ+_Ur_VduVh0kmZVA+bXMjFA8iQrJ6Qwv9nAxkLc5tQ@mail.gmail.com
State New
Headers show

Commit Message

Prasad Ghangal Dec. 28, 2016, 6:27 p.m. UTC
Hi,
The attached patch tries fix ICE due to undeclared variable(s) in the input.
Successfully bootstrapped on x86_64-pc-linux-gnu, testing is in progress


Thanks,
Prasad

Comments

Prasad Ghangal Dec. 28, 2016, 6:39 p.m. UTC | #1
Sorry for the wrong email address.

On 28 December 2016 at 23:57, Prasad Ghangal <prasad.ghangal@gmail.com> wrote:
> Hi,
> The attached patch tries fix ICE due to undeclared variable(s) in the input.
> Successfully bootstrapped on x86_64-pc-linux-gnu, testing is in progress
>
>
> Thanks,
> Prasad
Richard Biener Jan. 4, 2017, 10:32 a.m. UTC | #2
On Wed, Dec 28, 2016 at 7:27 PM, Prasad Ghangal
<prasad.ghangal@gmail.com> wrote:
> Hi,
> The attached patch tries fix ICE due to undeclared variable(s) in the input.
> Successfully bootstrapped on x86_64-pc-linux-gnu, testing is in progress

Ok.

Richard.

>
> Thanks,
> Prasad
Prasad Ghangal Feb. 6, 2017, 6 a.m. UTC | #3
On 4 January 2017 at 16:02, Richard Biener <richard.guenther@gmail.com> wrote:
> On Wed, Dec 28, 2016 at 7:27 PM, Prasad Ghangal
> <prasad.ghangal@gmail.com> wrote:
>> Hi,
>> The attached patch tries fix ICE due to undeclared variable(s) in the input.
>> Successfully bootstrapped on x86_64-pc-linux-gnu, testing is in progress
>
> Ok.
>
Can you please commit the patch? I don't have access for that.

Thanks,
Prasad

> Richard.
>
>>
>> Thanks,
>> Prasad
Richard Biener Feb. 7, 2017, 8:10 a.m. UTC | #4
On Mon, Feb 6, 2017 at 7:00 AM, Prasad Ghangal <prasad.ghangal@gmail.com> wrote:
> On 4 January 2017 at 16:02, Richard Biener <richard.guenther@gmail.com> wrote:
>> On Wed, Dec 28, 2016 at 7:27 PM, Prasad Ghangal
>> <prasad.ghangal@gmail.com> wrote:
>>> Hi,
>>> The attached patch tries fix ICE due to undeclared variable(s) in the input.
>>> Successfully bootstrapped on x86_64-pc-linux-gnu, testing is in progress
>>
>> Ok.
>>
> Can you please commit the patch? I don't have access for that.

Can you share a testcase that broke?  I tried

int __GIMPLE foo(int a)
{
  if (t1 != 2)
    goto bb1;
  else
    goto bb2;

bb1:
  return t1;

bb2:
  return 1;
}

and it reports

t.c: In function ‘foo’:
t.c:3:7: error: ‘t1’ undeclared (first use in this function)
   if (t1 != 2)
       ^~
t.c:3:7: note: each undeclared identifier is reported only once for
each function it appears in
t.c:9:10: error: invalid conversion in return statement
   return t1;
          ^~
t.c:1:14: note: declared here
 int __GIMPLE foo(int a)
              ^~~

and thus doesn't ICE.

Maybe one of my patches in this area made yours redundant (it doesn't
apply cleanly anymore as well).

Thanks,
Richard.

> Thanks,
> Prasad
>
>> Richard.
>>
>>>
>>> Thanks,
>>> Prasad
Prasad Ghangal Feb. 9, 2017, 6 a.m. UTC | #5
On 7 February 2017 at 13:40, Richard Biener <richard.guenther@gmail.com> wrote:
> On Mon, Feb 6, 2017 at 7:00 AM, Prasad Ghangal <prasad.ghangal@gmail.com> wrote:
>> On 4 January 2017 at 16:02, Richard Biener <richard.guenther@gmail.com> wrote:
>>> On Wed, Dec 28, 2016 at 7:27 PM, Prasad Ghangal
>>> <prasad.ghangal@gmail.com> wrote:
>>>> Hi,
>>>> The attached patch tries fix ICE due to undeclared variable(s) in the input.
>>>> Successfully bootstrapped on x86_64-pc-linux-gnu, testing is in progress
>>>
>>> Ok.
>>>
>> Can you please commit the patch? I don't have access for that.
>
> Can you share a testcase that broke?  I tried
>

Consider following testcases:

Case 1:
int __GIMPLE foo()
{
  if (a != 2)
    goto bb1;
  else
    goto bb2;

bb1:
  a_1 = 10;
  return a_1;

bb2:
  return 1;
}

gives:

 foo
gcc/test.c: In function ‘foo’:
gcc/test.c:3:7: error: ‘a’ undeclared (first use in this function)
   if (a != 2)
       ^
gcc/test.c:3:7: note: each undeclared identifier is reported only once
for each function it appears in
gcc/test.c:9:3: internal compiler error: in make_ssa_name_fn, at
tree-ssanames.c:268
   a_1 = 10;
   ^~~
0x1199aa0 make_ssa_name_fn(function*, tree_node*, gimple*, unsigned int)
        ../../git_gcc/gcc/tree-ssanames.c:265
0x839e2c c_parser_parse_ssa_name
        ../../git_gcc/gcc/c/gimple-parser.c:675
0x83a5e6 c_parser_gimple_postfix_expression
        ../../git_gcc/gcc/c/gimple-parser.c:845
0x839ac5 c_parser_gimple_unary_expression
        ../../git_gcc/gcc/c/gimple-parser.c:603
0x838544 c_parser_gimple_statement
        ../../git_gcc/gcc/c/gimple-parser.c:271
0x83848e c_parser_gimple_compound_statement
        ../../git_gcc/gcc/c/gimple-parser.c:226
0x837fd2 c_parser_parse_gimple_body(c_parser*)
        ../../git_gcc/gcc/c/gimple-parser.c:92
0x7f7bb5 c_parser_declaration_or_fndef
        ../../git_gcc/gcc/c/c-parser.c:2091
0x7f628a c_parser_external_declaration
        ../../git_gcc/gcc/c/c-parser.c:1468
0x7f5dd3 c_parser_translation_unit
        ../../git_gcc/gcc/c/c-parser.c:1348
0x82a3c4 c_parse_file()
        ../../git_gcc/gcc/c/c-parser.c:18185
0x89c5d9 c_common_parse_file()
        ../../git_gcc/gcc/c-family/c-opts.c:1107
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.



Case 2:

int __GIMPLE ()
main (int argc, char * * argv)
{

  bb_2:
  switch (a) {default: L2; case 1: L0; case 2: L1; }

L0:
  a = 0;
  goto bb_6;

L1:
  a = 3;
  goto L2;

L2:
  return a;

}

 main
gcc/test3.c: In function ‘main’:
gcc/test3.c:6:11: error: ‘a’ undeclared (first use in this function)
   switch (a) {default: L2; case 1: L0; case 2: L1; }
           ^
gcc/test3.c:6:11: note: each undeclared identifier is reported only
once for each function it appears in
gcc/test3.c:6:3: internal compiler error: in gimple_switch_set_index,
at gimple.h:4513
   switch (a) {default: L2; case 1: L0; case 2: L1; }
   ^~~~~~
0xb31385 gimple_switch_set_index
        ../../git_gcc/gcc/gimple.h:4513
0xb33b3f gimple_build_switch_nlabels(unsigned int, tree_node*, tree_node*)
        ../../git_gcc/gcc/gimple.c:757
0xb33b90 gimple_build_switch(tree_node*, tree_node*, vec<tree_node*,
va_heap, vl_ptr>)
        ../../git_gcc/gcc/gimple.c:773
0x83bd94 c_parser_gimple_switch_stmt
        ../../git_gcc/gcc/c/gimple-parser.c:1445
0x83832c c_parser_gimple_compound_statement
        ../../git_gcc/gcc/c/gimple-parser.c:175
0x837fd2 c_parser_parse_gimple_body(c_parser*)
        ../../git_gcc/gcc/c/gimple-parser.c:92
0x7f7bb5 c_parser_declaration_or_fndef
        ../../git_gcc/gcc/c/c-parser.c:2091
0x7f628a c_parser_external_declaration
        ../../git_gcc/gcc/c/c-parser.c:1468
0x7f5dd3 c_parser_translation_unit
        ../../git_gcc/gcc/c/c-parser.c:1348
0x82a3c4 c_parse_file()
        ../../git_gcc/gcc/c/c-parser.c:18185
0x89c5d9 c_common_parse_file()
        ../../git_gcc/gcc/c-family/c-opts.c:1107
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


Case 3:

void __GIMPLE () foo (int a)
{
bb_2:
  a = *b;

bb_3:
  return;
}

 foo
gcc/test6.c: In function ‘foo’:
gcc/test6.c:5:8: error: ‘b’ undeclared (first use in this function)
   a = *b;
        ^
gcc/test6.c:5:8: note: each undeclared identifier is reported only
once for each function it appears in
gcc/test6.c:5:3: internal compiler error: tree check: expected class
‘type’, have ‘exceptional’ (error_mark) in build_int_cst, at
tree.c:1297
   a = *b;
   ^
0x125cd92 tree_class_check_failed(tree_node const*, tree_code_class,
char const*, int, char const*)
        ../../git_gcc/gcc/tree.c:9866
0x77f8e3 tree_class_check(tree_node*, tree_code_class, char const*,
int, char const*)
        ../../git_gcc/gcc/tree.h:3183
0x123db1e build_int_cst(tree_node*, long)
        ../../git_gcc/gcc/tree.c:1297
0x124b279 build_simple_mem_ref_loc(unsigned int, tree_node*)
        ../../git_gcc/gcc/tree.c:4634
0x8396a8 c_parser_gimple_unary_expression
        ../../git_gcc/gcc/c/gimple-parser.c:565
0x838c9a c_parser_gimple_statement
        ../../git_gcc/gcc/c/gimple-parser.c:339
0x83848e c_parser_gimple_compound_statement
        ../../git_gcc/gcc/c/gimple-parser.c:226
0x837fd2 c_parser_parse_gimple_body(c_parser*)
        ../../git_gcc/gcc/c/gimple-parser.c:92
0x7f7bb5 c_parser_declaration_or_fndef
        ../../git_gcc/gcc/c/c-parser.c:2091
0x7f628a c_parser_external_declaration
        ../../git_gcc/gcc/c/c-parser.c:1468
0x7f5dd3 c_parser_translation_unit
        ../../git_gcc/gcc/c/c-parser.c:1348
0x82a3c4 c_parse_file()
        ../../git_gcc/gcc/c/c-parser.c:18185
0x89c5d9 c_common_parse_file()
        ../../git_gcc/gcc/c-family/c-opts.c:1107
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


> int __GIMPLE foo(int a)
> {
>   if (t1 != 2)
>     goto bb1;
>   else
>     goto bb2;
>
> bb1:
>   return t1;
>
> bb2:
>   return 1;
> }
>
> and it reports
>
> t.c: In function ‘foo’:
> t.c:3:7: error: ‘t1’ undeclared (first use in this function)
>    if (t1 != 2)
>        ^~
> t.c:3:7: note: each undeclared identifier is reported only once for
> each function it appears in
> t.c:9:10: error: invalid conversion in return statement
>    return t1;
>           ^~
> t.c:1:14: note: declared here
>  int __GIMPLE foo(int a)
>               ^~~
>
> and thus doesn't ICE.
>
> Maybe one of my patches in this area made yours redundant (it doesn't
> apply cleanly anymore as well).

I have rebased and updated the patch.


Thanks,
Prasad

>
> Thanks,
> Richard.
>
>> Thanks,
>> Prasad
>>
>>> Richard.
>>>
>>>>
>>>> Thanks,
>>>> Prasad
Richard Biener Feb. 10, 2017, 12:45 p.m. UTC | #6
On Thu, Feb 9, 2017 at 7:00 AM, Prasad Ghangal <prasad.ghangal@gmail.com> wrote:
> On 7 February 2017 at 13:40, Richard Biener <richard.guenther@gmail.com> wrote:
>> On Mon, Feb 6, 2017 at 7:00 AM, Prasad Ghangal <prasad.ghangal@gmail.com> wrote:
>>> On 4 January 2017 at 16:02, Richard Biener <richard.guenther@gmail.com> wrote:
>>>> On Wed, Dec 28, 2016 at 7:27 PM, Prasad Ghangal
>>>> <prasad.ghangal@gmail.com> wrote:
>>>>> Hi,
>>>>> The attached patch tries fix ICE due to undeclared variable(s) in the input.
>>>>> Successfully bootstrapped on x86_64-pc-linux-gnu, testing is in progress
>>>>
>>>> Ok.
>>>>
>>> Can you please commit the patch? I don't have access for that.
>>
>> Can you share a testcase that broke?  I tried
>>
>
> Consider following testcases:
>
> Case 1:
> int __GIMPLE foo()
> {
>   if (a != 2)
>     goto bb1;
>   else
>     goto bb2;
>
> bb1:
>   a_1 = 10;
>   return a_1;
>
> bb2:
>   return 1;
> }
>
> gives:
>
>  foo
> gcc/test.c: In function ‘foo’:
> gcc/test.c:3:7: error: ‘a’ undeclared (first use in this function)
>    if (a != 2)
>        ^
> gcc/test.c:3:7: note: each undeclared identifier is reported only once
> for each function it appears in
> gcc/test.c:9:3: internal compiler error: in make_ssa_name_fn, at
> tree-ssanames.c:268
>    a_1 = 10;
>    ^~~
> 0x1199aa0 make_ssa_name_fn(function*, tree_node*, gimple*, unsigned int)
>         ../../git_gcc/gcc/tree-ssanames.c:265
> 0x839e2c c_parser_parse_ssa_name
>         ../../git_gcc/gcc/c/gimple-parser.c:675
> 0x83a5e6 c_parser_gimple_postfix_expression
>         ../../git_gcc/gcc/c/gimple-parser.c:845
> 0x839ac5 c_parser_gimple_unary_expression
>         ../../git_gcc/gcc/c/gimple-parser.c:603
> 0x838544 c_parser_gimple_statement
>         ../../git_gcc/gcc/c/gimple-parser.c:271
> 0x83848e c_parser_gimple_compound_statement
>         ../../git_gcc/gcc/c/gimple-parser.c:226
> 0x837fd2 c_parser_parse_gimple_body(c_parser*)
>         ../../git_gcc/gcc/c/gimple-parser.c:92
> 0x7f7bb5 c_parser_declaration_or_fndef
>         ../../git_gcc/gcc/c/c-parser.c:2091
> 0x7f628a c_parser_external_declaration
>         ../../git_gcc/gcc/c/c-parser.c:1468
> 0x7f5dd3 c_parser_translation_unit
>         ../../git_gcc/gcc/c/c-parser.c:1348
> 0x82a3c4 c_parse_file()
>         ../../git_gcc/gcc/c/c-parser.c:18185
> 0x89c5d9 c_common_parse_file()
>         ../../git_gcc/gcc/c-family/c-opts.c:1107
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.
>
>
>
> Case 2:
>
> int __GIMPLE ()
> main (int argc, char * * argv)
> {
>
>   bb_2:
>   switch (a) {default: L2; case 1: L0; case 2: L1; }
>
> L0:
>   a = 0;
>   goto bb_6;
>
> L1:
>   a = 3;
>   goto L2;
>
> L2:
>   return a;
>
> }
>
>  main
> gcc/test3.c: In function ‘main’:
> gcc/test3.c:6:11: error: ‘a’ undeclared (first use in this function)
>    switch (a) {default: L2; case 1: L0; case 2: L1; }
>            ^
> gcc/test3.c:6:11: note: each undeclared identifier is reported only
> once for each function it appears in
> gcc/test3.c:6:3: internal compiler error: in gimple_switch_set_index,
> at gimple.h:4513
>    switch (a) {default: L2; case 1: L0; case 2: L1; }
>    ^~~~~~
> 0xb31385 gimple_switch_set_index
>         ../../git_gcc/gcc/gimple.h:4513
> 0xb33b3f gimple_build_switch_nlabels(unsigned int, tree_node*, tree_node*)
>         ../../git_gcc/gcc/gimple.c:757
> 0xb33b90 gimple_build_switch(tree_node*, tree_node*, vec<tree_node*,
> va_heap, vl_ptr>)
>         ../../git_gcc/gcc/gimple.c:773
> 0x83bd94 c_parser_gimple_switch_stmt
>         ../../git_gcc/gcc/c/gimple-parser.c:1445
> 0x83832c c_parser_gimple_compound_statement
>         ../../git_gcc/gcc/c/gimple-parser.c:175
> 0x837fd2 c_parser_parse_gimple_body(c_parser*)
>         ../../git_gcc/gcc/c/gimple-parser.c:92
> 0x7f7bb5 c_parser_declaration_or_fndef
>         ../../git_gcc/gcc/c/c-parser.c:2091
> 0x7f628a c_parser_external_declaration
>         ../../git_gcc/gcc/c/c-parser.c:1468
> 0x7f5dd3 c_parser_translation_unit
>         ../../git_gcc/gcc/c/c-parser.c:1348
> 0x82a3c4 c_parse_file()
>         ../../git_gcc/gcc/c/c-parser.c:18185
> 0x89c5d9 c_common_parse_file()
>         ../../git_gcc/gcc/c-family/c-opts.c:1107
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.
>
>
> Case 3:
>
> void __GIMPLE () foo (int a)
> {
> bb_2:
>   a = *b;
>
> bb_3:
>   return;
> }
>
>  foo
> gcc/test6.c: In function ‘foo’:
> gcc/test6.c:5:8: error: ‘b’ undeclared (first use in this function)
>    a = *b;
>         ^
> gcc/test6.c:5:8: note: each undeclared identifier is reported only
> once for each function it appears in
> gcc/test6.c:5:3: internal compiler error: tree check: expected class
> ‘type’, have ‘exceptional’ (error_mark) in build_int_cst, at
> tree.c:1297
>    a = *b;
>    ^
> 0x125cd92 tree_class_check_failed(tree_node const*, tree_code_class,
> char const*, int, char const*)
>         ../../git_gcc/gcc/tree.c:9866
> 0x77f8e3 tree_class_check(tree_node*, tree_code_class, char const*,
> int, char const*)
>         ../../git_gcc/gcc/tree.h:3183
> 0x123db1e build_int_cst(tree_node*, long)
>         ../../git_gcc/gcc/tree.c:1297
> 0x124b279 build_simple_mem_ref_loc(unsigned int, tree_node*)
>         ../../git_gcc/gcc/tree.c:4634
> 0x8396a8 c_parser_gimple_unary_expression
>         ../../git_gcc/gcc/c/gimple-parser.c:565
> 0x838c9a c_parser_gimple_statement
>         ../../git_gcc/gcc/c/gimple-parser.c:339
> 0x83848e c_parser_gimple_compound_statement
>         ../../git_gcc/gcc/c/gimple-parser.c:226
> 0x837fd2 c_parser_parse_gimple_body(c_parser*)
>         ../../git_gcc/gcc/c/gimple-parser.c:92
> 0x7f7bb5 c_parser_declaration_or_fndef
>         ../../git_gcc/gcc/c/c-parser.c:2091
> 0x7f628a c_parser_external_declaration
>         ../../git_gcc/gcc/c/c-parser.c:1468
> 0x7f5dd3 c_parser_translation_unit
>         ../../git_gcc/gcc/c/c-parser.c:1348
> 0x82a3c4 c_parse_file()
>         ../../git_gcc/gcc/c/c-parser.c:18185
> 0x89c5d9 c_common_parse_file()
>         ../../git_gcc/gcc/c-family/c-opts.c:1107
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.
>
>
>> int __GIMPLE foo(int a)
>> {
>>   if (t1 != 2)
>>     goto bb1;
>>   else
>>     goto bb2;
>>
>> bb1:
>>   return t1;
>>
>> bb2:
>>   return 1;
>> }
>>
>> and it reports
>>
>> t.c: In function ‘foo’:
>> t.c:3:7: error: ‘t1’ undeclared (first use in this function)
>>    if (t1 != 2)
>>        ^~
>> t.c:3:7: note: each undeclared identifier is reported only once for
>> each function it appears in
>> t.c:9:10: error: invalid conversion in return statement
>>    return t1;
>>           ^~
>> t.c:1:14: note: declared here
>>  int __GIMPLE foo(int a)
>>               ^~~
>>
>> and thus doesn't ICE.
>>
>> Maybe one of my patches in this area made yours redundant (it doesn't
>> apply cleanly anymore as well).
>
> I have rebased and updated the patch.

Thanks.  I have turned those into testcases and applied the attached
slighly changed patch.

Bootstrapped / tested on x86_64-unknown-linux-gnu.

Richard.

>
> Thanks,
> Prasad
>
>>
>> Thanks,
>> Richard.
>>
>>> Thanks,
>>> Prasad
>>>
>>>> Richard.
>>>>
>>>>>
>>>>> Thanks,
>>>>> Prasad
diff mbox

Patch

diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index b7cef93..13bf2b1 100644
--- a/gcc/c/gimple-parser.c
+++ b/gcc/c/gimple-parser.c
@@ -516,7 +516,9 @@  c_parser_gimple_binary_expression (c_parser *parser)
   rhs = c_parser_gimple_postfix_expression (parser);
   if (c_parser_error (parser))
     return ret;
-  ret.value = build2_loc (ret_loc, code, ret_type, lhs.value, rhs.value);
+
+  if (lhs.value != error_mark_node && rhs.value != error_mark_node)
+    ret.value = build2_loc (ret_loc, code, ret_type, lhs.value, rhs.value);
   return ret;
 }
 
@@ -653,7 +655,7 @@  c_parser_parse_ssa_name (c_parser *parser,
 	  id = get_identifier (var_name);
 	  tree parent = lookup_name (id);
 	  XDELETEVEC (var_name);
-	  if (! parent)
+	  if (! parent || parent == error_mark_node)
 	    {
 	      c_parser_error (parser, "base variable or SSA name not declared"); 
 	      return error_mark_node;
@@ -1194,6 +1196,8 @@  c_parser_gimple_if_stmt (c_parser *parser, gimple_seq *seq)
   location_t loc;
   c_parser_consume_token (parser);
   tree cond = c_parser_gimple_paren_condition (parser);
+  if (cond == error_mark_node)
+    return;
 
   if (c_parser_next_token_is_keyword (parser, RID_GOTO))
     {
@@ -1252,7 +1256,7 @@  c_parser_gimple_if_stmt (c_parser *parser, gimple_seq *seq)
 static void
 c_parser_gimple_switch_stmt (c_parser *parser, gimple_seq *seq)
 {
-  c_expr cond_expr;
+  tree cond = error_mark_node;
   tree case_label, label;
   auto_vec<tree> labels;
   tree default_label = NULL_TREE;
@@ -1261,9 +1265,11 @@  c_parser_gimple_switch_stmt (c_parser *parser, gimple_seq *seq)
 
   if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
     {
-      cond_expr = c_parser_gimple_postfix_expression (parser);
+      cond = c_parser_gimple_postfix_expression (parser).value;
       if (! c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>"))
 	return;
+      if (cond == error_mark_node)
+	return;
     }
 
   if (c_parser_require (parser, CPP_OPEN_BRACE, "expected %<{%>"))
@@ -1374,7 +1380,7 @@  c_parser_gimple_switch_stmt (c_parser *parser, gimple_seq *seq)
     }
   if (! c_parser_require (parser, CPP_CLOSE_BRACE, "expected %<}%>"))
     return;
-  gimple_seq_add_stmt (seq, gimple_build_switch (cond_expr.value,
+  gimple_seq_add_stmt (seq, gimple_build_switch (cond,
 						 default_label, labels));
   gimple_seq_add_seq (seq, switch_body);
   labels.release();