Bug 91042 - [7/8/9 Regression] ICE in convert_move, at expr.c:218
Summary: [7/8/9 Regression] ICE in convert_move, at expr.c:218
Status: RESOLVED DUPLICATE of bug 90756
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 9.1.1
: P3 normal
Target Milestone: 7.5
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2019-07-01 08:42 UTC by Andreas Schwab
Modified: 2019-07-03 07:31 UTC (History)
1 user (show)

See Also:
Host:
Target: armv7l-*-*
Build:
Known to work: 10.0
Known to fail: 7.4.1, 8.3.1, 9.1.1
Last reconfirmed: 2019-07-01 00:00:00


Attachments
Test case (27.72 KB, text/plain)
2019-07-01 08:42 UTC, Andreas Schwab
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schwab 2019-07-01 08:42:30 UTC
Created attachment 46538 [details]
Test case

$ g++ -w -O2 -c skcms.ii
during RTL pass: expand
In file included from ../../3rdparty/chromium/third_party/skia/third_party/skcms/skcms.cc:1867:
../../3rdparty/chromium/third_party/skia/third_party/skcms/src/Transform_inl.h: In function 'void baseline::exec_ops(const Op*, const void**, const char*, char*, int)':
../../3rdparty/chromium/third_party/skia/third_party/skcms/src/Transform_inl.h:640:13: internal compiler error: in convert_move, at expr.c:218
  640 | static void exec_ops(const Op* ops, const void** args,
      |             ^~~~~~~~
$ g++ --version
g++ (SUSE Linux) 9.1.1 20190611 [gcc-9-branch revision 272147]
Comment 1 Martin Liška 2019-07-01 09:09:40 UTC
I can confirm that with GCC 9.1 cross compiler, I'm reducing that.
Comment 2 ktkachov 2019-07-01 09:13:51 UTC
Confirmed on the branches. May need -mfloat-abi=soft depending on your configuration. Doesn't ICE on trunk though.
Comment 3 Martin Liška 2019-07-01 09:23:02 UTC
Reduced test-case:

$ cat pr91042.cc
typedef enum { Op_swap_rb, Op_matrix_3x3 } Op;
template <int N, typename T> struct A {
  typedef T __attribute__((vector_size(N * sizeof(int)))) V;
};
template <int N, typename T> using Vec = typename A<N, T>::V;
using F = Vec<4, float>;
template <typename T, typename P> void store(P p1, T p2) {
  __builtin_memcpy(p1, &p2, sizeof(p2));
}
Op a;
int b;
F c, d;
__attribute__((__vector_size__(4 * sizeof(int)))) unsigned e;
void exec_ops() {
  while (true)
    switch (a) {
    case Op_swap_rb: {
      F t = c;
      c = d;
      d = t;
    }
    case Op_matrix_3x3:
      store(&b, e);
    }
}
Comment 4 Martin Liška 2019-07-01 09:26:41 UTC
@Kyril: Is it really failing for GCC 7.x ?

For me it works:

$ arm-suse-linux-gnueabi-g++-7 -v
gcc version 7.4.1 20190424 [gcc-7-branch revision 270538] (SUSE Linux) 

$ arm-suse-linux-gnueabi-g++-7 ~/Programming/testcases/pr91042.cc -c -O2
In function 'void store(P, T) [with T = __vector(4) unsigned int; P = int*]',
    inlined from 'void exec_ops()' at /home/marxin/Programming/testcases/pr91042.cc:23:12:
/home/marxin/Programming/testcases/pr91042.cc:8:19: warning: 'void* __builtin_memcpy(void*, const void*, unsigned int)' writing 16 bytes into a region of size 4 overflows the destination [-Wstringop-overflow=]
   __builtin_memcpy(p1, &p2, sizeof(p2));
   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
Comment 5 ktkachov 2019-07-01 09:29:37 UTC
(In reply to Martin Liška from comment #4)
> @Kyril: Is it really failing for GCC 7.x ?
> 
> For me it works:
> 
> $ arm-suse-linux-gnueabi-g++-7 -v
> gcc version 7.4.1 20190424 [gcc-7-branch revision 270538] (SUSE Linux) 
> 
> $ arm-suse-linux-gnueabi-g++-7 ~/Programming/testcases/pr91042.cc -c -O2
> In function 'void store(P, T) [with T = __vector(4) unsigned int; P = int*]',
>     inlined from 'void exec_ops()' at
> /home/marxin/Programming/testcases/pr91042.cc:23:12:
> /home/marxin/Programming/testcases/pr91042.cc:8:19: warning: 'void*
> __builtin_memcpy(void*, const void*, unsigned int)' writing 16 bytes into a
> region of size 4 overflows the destination [-Wstringop-overflow=]
>    __builtin_memcpy(p1, &p2, sizeof(p2));
>    ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~

Yeah, it ICE's for me (even with 6.5.0), just double-checked:
gcc version 7.4.1 20190627

--with-arch=armv7-a --with-fpu=neon --with-float=hard --with-arch=armv7-a
Comment 6 ktkachov 2019-07-01 09:31:21 UTC
ahh, GCC 7 ICEs on the full testcase for me, but not on the reduced one
Comment 7 Martin Liška 2019-07-01 09:34:15 UTC
(In reply to ktkachov from comment #6)
> ahh, GCC 7 ICEs on the full testcase for me, but not on the reduced one

Yes, you are right. I'm reducing that one more time with GCC7.
Comment 8 Martin Liška 2019-07-01 09:46:06 UTC
This fails for all versions (7,8,9) for me:

$ cat pr91042.cc
typedef enum { Op_swap_rb, Op_matrix_3x3 } Op;
template <int N, typename T> struct A {
  typedef T __attribute__((vector_size(N * sizeof(T)))) V;
};
template <int N, typename T> using Vec = typename A<N, T>::V;
using F = Vec<4, float>;
using U8 = Vec<4, unsigned char>;
template <typename T, typename P> void store(P p1, T p2) {
  __builtin_memcpy(p1, &p2, sizeof(p2));
}
template <typename D, typename S> D cast(S p1) { return D{p1[3]}; }
Op *a;
int b;
F c, d;
void exec_ops() {
  while (true)
    switch (*a) {
    case Op_swap_rb: {
      F t = c;
      c = d;
      d = t;
    }
    case Op_matrix_3x3:
      __attribute__((__vector_size__(4))) unsigned char e = cast<U8>(d);
      store(&b, e);
    }
}
Comment 9 Jakub Jelinek 2019-07-01 11:35:39 UTC
Possible dup of PR90756 ?
Comment 10 Jakub Jelinek 2019-07-03 07:31:58 UTC
The latest patch in PR90756 fixes this too.

*** This bug has been marked as a duplicate of bug 90756 ***