public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/111903] New: [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16
@ 2023-10-20 21:00 zsojka at seznam dot cz
  2023-10-20 21:03 ` [Bug c/111903] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2023-10-20 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111903
           Summary: [14 Regression] ICE: tree check: expected class
                    'type', have 'exceptional' (error_mark) in
                    create_tmp_from_val, at gimplify.cc:567 with -mno-sse2
                    and _Float16
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 56160
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56160&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -mno-sse2 testcase.c
testcase.c: In function 'foo':
testcase.c:7:8: warning: implicit declaration of function 'bar'
[-Wimplicit-function-declaration]
    7 |   i /= bar ((_Complex _Float16) f);
      |        ^~~
testcase.c:7:3: error: invalid conversion to type '_Float16' without option
'-msse2'
    7 |   i /= bar ((_Complex _Float16) f);
      |   ^
testcase.c:7:8: internal compiler error: tree check: expected class 'type',
have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567
    7 |   i /= bar ((_Complex _Float16) f);
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
0x87927f tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        /repo/gcc-trunk/gcc/tree.cc:8997
0x77a7ed tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        /repo/gcc-trunk/gcc/tree.h:3751
0x77a7ed create_tmp_from_val
        /repo/gcc-trunk/gcc/gimplify.cc:567
0x77a7ed lookup_tmp_var
        /repo/gcc-trunk/gcc/gimplify.cc:590
0x77a7ed internal_get_tmp_var
        /repo/gcc-trunk/gcc/gimplify.cc:645
0x117e76e get_initialized_tmp_var(tree_node*, gimple**, gimple**, bool)
        /repo/gcc-trunk/gcc/gimplify.cc:684
0x117e76e gimplify_save_expr
        /repo/gcc-trunk/gcc/gimplify.cc:6690
0x1176c8e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /repo/gcc-trunk/gcc/gimplify.cc:16995
0x1188507 gimplify_stmt(tree_node**, gimple**)
        /repo/gcc-trunk/gcc/gimplify.cc:7453
0x1188507 gimplify_compound_expr
        /repo/gcc-trunk/gcc/gimplify.cc:6639
0x117753b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /repo/gcc-trunk/gcc/gimplify.cc:16684
0x1178fd6 gimplify_stmt(tree_node**, gimple**)
        /repo/gcc-trunk/gcc/gimplify.cc:7453
0x117a0d9 gimplify_bind_expr
        /repo/gcc-trunk/gcc/gimplify.cc:1614
0x117751a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /repo/gcc-trunk/gcc/gimplify.cc:16895
0x1198b64 gimplify_stmt(tree_node**, gimple**)
        /repo/gcc-trunk/gcc/gimplify.cc:7453
0x1198b64 gimplify_body(tree_node*, bool)
        /repo/gcc-trunk/gcc/gimplify.cc:17961
0x1198f9a gimplify_function_tree(tree_node*)
        /repo/gcc-trunk/gcc/gimplify.cc:18160
0xf9f907 cgraph_node::analyze()
        /repo/gcc-trunk/gcc/cgraphunit.cc:684
0xfa2217 analyze_functions
        /repo/gcc-trunk/gcc/cgraphunit.cc:1247
0xfa2ebd symbol_table::finalize_compilation_unit()
        /repo/gcc-trunk/gcc/cgraphunit.cc:2554
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-4805-20231020221558-g7069ea909f5-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-4805-20231020221558-g7069ea909f5-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231020 (experimental) (GCC)

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

* [Bug c/111903] [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16
  2023-10-20 21:00 [Bug target/111903] New: [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16 zsojka at seznam dot cz
@ 2023-10-20 21:03 ` pinskia at gcc dot gnu.org
  2023-10-20 21:36 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-20 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Target Milestone|---                         |14.0
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
   Last reconfirmed|                            |2023-10-20
           Keywords|                            |error-recovery,
                   |                            |ice-checking
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
  if ((invalid_conv_diag
       = targetm.invalid_conversion (TREE_TYPE (expr), type)))
    {
      error (invalid_conv_diag);
      return error_mark_node;
    }


So this is a C front-end issue not expecting error_mark_node in some cases.

Looking into it further.

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

* [Bug c/111903] [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16
  2023-10-20 21:00 [Bug target/111903] New: [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16 zsojka at seznam dot cz
  2023-10-20 21:03 ` [Bug c/111903] " pinskia at gcc dot gnu.org
@ 2023-10-20 21:36 ` pinskia at gcc dot gnu.org
  2023-10-21 18:07 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-20 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This fixes the issue:
diff --git a/gcc/convert.cc b/gcc/convert.cc
index 64b7001843c..5357609d8f0 100644
--- a/gcc/convert.cc
+++ b/gcc/convert.cc
@@ -1006,8 +1006,13 @@ convert_to_complex_1 (tree type, tree expr, bool fold_p)
     case ENUMERAL_TYPE:
     case BOOLEAN_TYPE:
     case BITINT_TYPE:
-      return build2 (COMPLEX_EXPR, type, convert (subtype, expr),
-                    convert (subtype, integer_zero_node));
+      {
+       tree real = convert (subtype, expr);
+       tree imag = convert (subtype, integer_zero_node);
+       if (error_operand_p (real) || error_operand_p (imag))
+         return error_mark_node;
+       return build2 (COMPLEX_EXPR, type, real, imag);
+      }

     case COMPLEX_TYPE:
       {

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

* [Bug c/111903] [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16
  2023-10-20 21:00 [Bug target/111903] New: [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16 zsojka at seznam dot cz
  2023-10-20 21:03 ` [Bug c/111903] " pinskia at gcc dot gnu.org
  2023-10-20 21:36 ` pinskia at gcc dot gnu.org
@ 2023-10-21 18:07 ` pinskia at gcc dot gnu.org
  2023-10-23 10:55 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-21 18:07 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2023-October
                   |                            |/633840.html
           Keywords|                            |patch

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633840.html

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

* [Bug c/111903] [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16
  2023-10-20 21:00 [Bug target/111903] New: [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16 zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2023-10-21 18:07 ` pinskia at gcc dot gnu.org
@ 2023-10-23 10:55 ` cvs-commit at gcc dot gnu.org
  2023-10-23 10:55 ` cvs-commit at gcc dot gnu.org
  2023-10-23 10:56 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-23 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:13c0d052478bb45cc97869f5cc333f269aadb36f

commit r14-4858-g13c0d052478bb45cc97869f5cc333f269aadb36f
Author: Andrew Pinski <pinskia@gmail.com>
Date:   Fri Oct 20 14:47:55 2023 -0700

    convert_to_complex vs invalid_conversion [PR111903]

    convert_to_complex when creating a COMPLEX_EXPR does
    not currently check if either the real or imag parts
    was not error_mark_node. This later on confuses the gimpilfier
    when there was a SAVE_EXPR wrapped around that COMPLEX_EXPR.
    The simple fix is after calling convert inside convert_to_complex_1,
    check that the either result was an error_operand and return
    an error_mark_node in that case.

    Bootstrapped and tested on x86_64-linux-gnu with no regressions.

            PR c/111903

    gcc/ChangeLog:

            * convert.cc (convert_to_complex_1): Return
            error_mark_node if either convert was an error
            when converting from a scalar.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/float16-8.c: New test.

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

* [Bug c/111903] [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16
  2023-10-20 21:00 [Bug target/111903] New: [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16 zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2023-10-23 10:55 ` cvs-commit at gcc dot gnu.org
@ 2023-10-23 10:55 ` cvs-commit at gcc dot gnu.org
  2023-10-23 10:56 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-23 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:85e930ac8557c444680b5b29a0a13a14ea6672b5

commit r14-4859-g85e930ac8557c444680b5b29a0a13a14ea6672b5
Author: Andrew Pinski <pinskia@gmail.com>
Date:   Fri Oct 20 14:49:32 2023 -0700

    Use error_mark_node after error in convert

    While working on PR c/111903, I Noticed that
    convert will convert integer_zero_node to that
    type after an error instead of returning error_mark_node.
    From what I can tell this was the old way of not having
    error recovery since other places in this file does return
    error_mark_node and the places I am replacing date from
    when the file was imported into the repro (either via a gcc2 merge
    or earlier).

    I also had to update the objc front-end to allow for the error_mark_node
    change, I suspect you could hit the ICE without this change though.

    Bootstrapped and tested on x86_64-linux-gnu with no regressions.

    gcc/ChangeLog:

            * convert.cc (convert_to_pointer_1): Return error_mark_node
            after an error.
            (convert_to_real_1): Likewise.
            (convert_to_integer_1): Likewise.
            (convert_to_complex_1): Likewise.

    gcc/objc/ChangeLog:

            * objc-gnu-runtime-abi-01.cc (build_objc_method_call): Allow
            for error_operand after call to build_c_cast.
            * objc-next-runtime-abi-01.cc (build_objc_method_call): Likewise.
            * objc-next-runtime-abi-02.cc (build_v2_build_objc_method_call):
Likewise.

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

* [Bug c/111903] [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16
  2023-10-20 21:00 [Bug target/111903] New: [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16 zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2023-10-23 10:55 ` cvs-commit at gcc dot gnu.org
@ 2023-10-23 10:56 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-23 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-10-23 10:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20 21:00 [Bug target/111903] New: [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16 zsojka at seznam dot cz
2023-10-20 21:03 ` [Bug c/111903] " pinskia at gcc dot gnu.org
2023-10-20 21:36 ` pinskia at gcc dot gnu.org
2023-10-21 18:07 ` pinskia at gcc dot gnu.org
2023-10-23 10:55 ` cvs-commit at gcc dot gnu.org
2023-10-23 10:55 ` cvs-commit at gcc dot gnu.org
2023-10-23 10:56 ` pinskia 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).