Bug 112505 - [11 Regression] internal compiler error: in build_vector_from_val, at tree.cc:2104 since r10-4076
Summary: [11 Regression] internal compiler error: in build_vector_from_val, at tree.c...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 14.0
: P2 normal
Target Milestone: 11.5
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: vectorizer
  Show dependency treegraph
 
Reported: 2023-11-13 03:45 UTC by wierton
Modified: 2024-06-21 09:37 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 11.1.0, 11.4.0, 12.3.1, 13.2.1, 14.0
Known to fail: 12.1.0, 12.3.0, 13.2.0
Last reconfirmed: 2023-11-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wierton 2023-11-13 03:45:15 UTC
Compiler Explorer: https://gcc.godbolt.org/z/nTjnh73xj

The crash triggering program (compile with `gcc-14 -O3`):
```
short int w9;
struct T {
  short a : 14;
  int b;
};
struct T v;
void __attribute__((simd)) zc() {
  w9 *= v.b ? v.a-- < 0 : 0;
}
```

The crash output:
```
during GIMPLE pass: vect
<source>: In function 'zc.simdclone.0':
<source>:7:28: internal compiler error: in build_vector_from_val, at tree.cc:2104
    7 | void __attribute__((simd)) zc() {
      |                            ^~
0x238b15e internal_error(char const*, ...)
	???:0
0xa11270 fancy_abort(char const*, int, char const*)
	???:0
0x13ee023 vectorizable_induction(_loop_vec_info*, _stmt_vec_info*, gimple**, _slp_tree*, vec<stmt_info_for_cost, va_heap, vl_ptr>*)
	???:0
0x2115bf8 vect_transform_stmt(vec_info*, _stmt_vec_info*, gimple_stmt_iterator*, _slp_tree*, _slp_instance*)
	???:0
0x13fedc0 vect_transform_loop(_loop_vec_info*, gimple*)
	???:0
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.
Compiler returned: 1
```
Comment 1 Andrew Pinski 2023-11-13 06:10:02 UTC
Simplier testcase:
```
short int w9;
struct T {
  short a : 14;
  int b;
};
struct T v;
void zc() {
        for(int i = 0; i < 4; i ++)
  w9 *= v.b ? v.a-- < 0 : 0;
}
```
Just compiler at `-O3 -fno-vect-cost-model`

  <unnamed-unsigned:14> _30;
  vector(4) unsigned short _31;
...
  _31 = {_60, _59, _2, _30};
  _52 = (vector(4) signed short) _31;
Comment 2 Andrew Pinski 2023-11-13 06:11:39 UTC
Looks like 11.x was not able to vectorize the loop.
Comment 3 Richard Biener 2023-11-13 09:32:28 UTC
Again bit-precision int:14 vs. 'int'.  Fallout of the bitfield vectorization support I guess.

Like the other PR we can fend this off in vectorizable_induction (I suppose
vectorizable_reduction might have similar issues).
Comment 4 Jakub Jelinek 2023-12-07 09:53:35 UTC
Started with r10-4076-g82e8e335f917b9ce40801838c06f7945cf88da43
Comment 5 Richard Biener 2024-01-11 13:08:04 UTC
I have a patch.
Comment 6 GCC Commits 2024-01-11 14:13:34 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:ec345df53556ec581590347f71c3d9ff3cdbca76

commit r14-7140-gec345df53556ec581590347f71c3d9ff3cdbca76
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 11 14:00:33 2024 +0100

    tree-optimization/112505 - bit-precision induction vectorization
    
    Vectorization of bit-precision inductions isn't implemented but we
    don't check this, instead we ICE during transform.
    
            PR tree-optimization/112505
            * tree-vect-loop.cc (vectorizable_induction): Reject
            bit-precision induction.
    
            * gcc.dg/vect/pr112505.c: New testcase.
Comment 7 GCC Commits 2024-02-06 13:20:15 UTC
The releases/gcc-13 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:9895fc7ab14f4cf571071184877f130b7bd0a59b

commit r13-8290-g9895fc7ab14f4cf571071184877f130b7bd0a59b
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 11 14:00:33 2024 +0100

    tree-optimization/112505 - bit-precision induction vectorization
    
    Vectorization of bit-precision inductions isn't implemented but we
    don't check this, instead we ICE during transform.
    
            PR tree-optimization/112505
            * tree-vect-loop.cc (vectorizable_induction): Reject
            bit-precision induction.
    
            * gcc.dg/vect/pr112505.c: New testcase.
    
    (cherry picked from commit ec345df53556ec581590347f71c3d9ff3cdbca76)
Comment 8 GCC Commits 2024-05-17 11:12:06 UTC
The releases/gcc-12 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:4a71557fbebe3fb4031d1c2adc4f89c89a8c6c62

commit r12-10454-g4a71557fbebe3fb4031d1c2adc4f89c89a8c6c62
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 11 14:00:33 2024 +0100

    tree-optimization/112505 - bit-precision induction vectorization
    
    Vectorization of bit-precision inductions isn't implemented but we
    don't check this, instead we ICE during transform.
    
            PR tree-optimization/112505
            * tree-vect-loop.cc (vectorizable_induction): Reject
            bit-precision induction.
    
            * gcc.dg/vect/pr112505.c: New testcase.
    
    (cherry picked from commit ec345df53556ec581590347f71c3d9ff3cdbca76)
Comment 9 GCC Commits 2024-06-21 09:22:22 UTC
The releases/gcc-11 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:ffaa61eb15dce3e48b4dcbca7161fc79ac9734b8

commit r11-11524-gffaa61eb15dce3e48b4dcbca7161fc79ac9734b8
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 11 14:00:33 2024 +0100

    tree-optimization/112505 - bit-precision induction vectorization
    
    Vectorization of bit-precision inductions isn't implemented but we
    don't check this, instead we ICE during transform.
    
            PR tree-optimization/112505
            * tree-vect-loop.c (vectorizable_induction): Reject
            bit-precision induction.
    
            * gcc.dg/vect/pr112505.c: New testcase.
    
    (cherry picked from commit ec345df53556ec581590347f71c3d9ff3cdbca76)
Comment 10 Richard Biener 2024-06-21 09:37:07 UTC
Fixed.