public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98200] New: [GIMPLE FE] ICE with parsing ternary expr with -fgimple
@ 2020-12-08 14:42 prathamesh3492 at gcc dot gnu.org
  2020-12-09  8:55 ` [Bug c/98200] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: prathamesh3492 at gcc dot gnu.org @ 2020-12-08 14:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98200

            Bug ID: 98200
           Summary: [GIMPLE FE] ICE with parsing ternary expr with
                    -fgimple
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: prathamesh3492 at gcc dot gnu.org
  Target Milestone: ---

Following test-case ICE's with -fgimple:

int __GIMPLE() f(int x, int y)
{
  int a;
  a = (x < y) ? 1 : 2;
  return a;
}


foo.c: In function ‘f’:
foo.c:4:7: error: expected expression before ‘(’ token
    4 |   a = (x < y) ? 1 : 2;
      |       ^
foo.c:4:7: internal compiler error: in extract_ops_from_tree, at
gimple-expr.c:556
0x6a1b64 extract_ops_from_tree(tree_node*, tree_code*, tree_node**,
tree_node**, tree_node**)
        ../../gcc/gcc/gimple-expr.c:556
0xb9ab20 gimple_build_assign(tree_node*, tree_node*)
        ../../gcc/gcc/gimple.c:436
0x91788a c_parser_gimple_statement
        ../../gcc/gcc/c/gimple-parser.c:879
0x91788a c_parser_gimple_compound_statement
        ../../gcc/gcc/c/gimple-parser.c:649
0x91788a c_parser_gimple_compound_statement
        ../../gcc/gcc/c/gimple-parser.c:381
0x919b77 c_parser_parse_gimple_body(c_parser*, char*, c_declspec_il,
profile_count)
        ../../gcc/gcc/c/gimple-parser.c:253
0x908e77 c_parser_declaration_or_fndef
        ../../gcc/gcc/c/c-parser.c:2533
0x9106b3 c_parser_external_declaration
        ../../gcc/gcc/c/c-parser.c:1777
0x911119 c_parser_translation_unit
        ../../gcc/gcc/c/c-parser.c:1650
0x911119 c_parse_file()
        ../../gcc/gcc/c/c-parser.c:21877
0x970de5 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1211

The ICE does not happen with parens around x < y are removed.
I guess even if this isn't syntactically valid input to gimple-fe,
it shouldn't ICE during parsing ?

Thanks,
Prathamesh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/98200] [GIMPLE FE] ICE with parsing ternary expr with -fgimple
  2020-12-08 14:42 [Bug c/98200] New: [GIMPLE FE] ICE with parsing ternary expr with -fgimple prathamesh3492 at gcc dot gnu.org
@ 2020-12-09  8:55 ` rguenth at gcc dot gnu.org
  2020-12-09 10:46 ` cvs-commit at gcc dot gnu.org
  2020-12-09 10:46 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-12-09  8:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98200

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-12-09
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
We parse (x < y) as CALL_EXPR because c_parser_gimple_postfix_expression
continues to c_parser_gimple_postfix_expression_after_primary after an error.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/98200] [GIMPLE FE] ICE with parsing ternary expr with -fgimple
  2020-12-08 14:42 [Bug c/98200] New: [GIMPLE FE] ICE with parsing ternary expr with -fgimple prathamesh3492 at gcc dot gnu.org
  2020-12-09  8:55 ` [Bug c/98200] " rguenth at gcc dot gnu.org
@ 2020-12-09 10:46 ` cvs-commit at gcc dot gnu.org
  2020-12-09 10:46 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-09 10:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98200

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:42bdf814493c2c39e7a6bd3fb2dd4491352ce5d9

commit r11-5877-g42bdf814493c2c39e7a6bd3fb2dd4491352ce5d9
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Dec 9 09:56:59 2020 +0100

    c/98200 - improve error recovery for GIMPLE FE

    This avoids ICEing by making sure to propagate error early.

    2020-12-09  Richard Biener  <rguenther@suse.de>

            PR c/98200
    gcc/c/
            * gimple-parser.c (c_parser_gimple_postfix_expression): Return
            early on error.

    gcc/testsuite/
            * gcc.dg/gimplefe-error-8.c: New testcase.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/98200] [GIMPLE FE] ICE with parsing ternary expr with -fgimple
  2020-12-08 14:42 [Bug c/98200] New: [GIMPLE FE] ICE with parsing ternary expr with -fgimple prathamesh3492 at gcc dot gnu.org
  2020-12-09  8:55 ` [Bug c/98200] " rguenth at gcc dot gnu.org
  2020-12-09 10:46 ` cvs-commit at gcc dot gnu.org
@ 2020-12-09 10:46 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-12-09 10:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98200

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-09 10:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 14:42 [Bug c/98200] New: [GIMPLE FE] ICE with parsing ternary expr with -fgimple prathamesh3492 at gcc dot gnu.org
2020-12-09  8:55 ` [Bug c/98200] " rguenth at gcc dot gnu.org
2020-12-09 10:46 ` cvs-commit at gcc dot gnu.org
2020-12-09 10:46 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).