public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’
@ 2023-01-12 14:53 dcb314 at hotmail dot com
  2023-01-12 14:56 ` [Bug c/108384] " dcb314 at hotmail dot com
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: dcb314 at hotmail dot com @ 2023-01-12 14:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108384
           Summary: error: conversion of register to a different size in
                    ‘view_convert_expr’
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Created attachment 54256
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54256&action=edit
C source code

The attached C code does this:

$ ~/gcc/results/bin/gcc -c -w -O3 -ftrivial-auto-var-init=zero bug873.c
testFile.4557.c: In function ‘func_1.isra’:
testFile.4557.c:130:16: error: conversion of register to a different size in
‘view_convert_expr’
VIEW_CONVERT_EXPR<short int>(removed_ipa_cp.834_390);

_393 = VIEW_CONVERT_EXPR<short int>(removed_ipa_cp.834_390);
during GIMPLE pass: fixup_cfg
testFile.4557.c:130:16: internal compiler error: verify_gimple failed
0xeaab49 verify_gimple_in_cfg(function*, bool, bool)
        ../../trunk.d1/gcc/tree-cfg.cc:5647
0xd46c5b execute_function_todo(function*, void*)
        ../../trunk.d1/gcc/passes.cc:2091

The bug first seems to occur sometime between git hash g:d901bf8a44a85e12
and g:b399afd22c6ea507.

A reduction is running now.

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

* [Bug c/108384] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
@ 2023-01-12 14:56 ` dcb314 at hotmail dot com
  2023-01-12 16:11 ` [Bug ipa/108384] " pinskia at gcc dot gnu.org
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dcb314 at hotmail dot com @ 2023-01-12 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
Reduced C code seems to be:

struct S0 {
  int f0;
  short f1;
  unsigned f2 : 7;
  short f3
};
g_389;
static *func_23();
func_2() {
  struct S0 l_26[] = {4, 5, 4, 6, 4, 5, 4, 6};
  func_23(l_26[1]);
}
*func_23(struct S0 p_24, struct S0 p_25) {
  int *l_1051 = g_389;
  if (safe_sub_func_int16_t_s_s())
    safe_lshift_func_uint8_t_u_s(p_24.f1);
  *l_1051 = p_25.f0;
}

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

* [Bug ipa/108384] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
  2023-01-12 14:56 ` [Bug c/108384] " dcb314 at hotmail dot com
@ 2023-01-12 16:11 ` pinskia at gcc dot gnu.org
  2023-01-12 16:26 ` dcb314 at hotmail dot com
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-12 16:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |ipa
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The code is undefined ...

  func_23(l_26[1]);

func_23(struct S0 p_24, struct S0 p_25)

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

* [Bug ipa/108384] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
  2023-01-12 14:56 ` [Bug c/108384] " dcb314 at hotmail dot com
  2023-01-12 16:11 ` [Bug ipa/108384] " pinskia at gcc dot gnu.org
@ 2023-01-12 16:26 ` dcb314 at hotmail dot com
  2023-01-12 17:05 ` dcb314 at hotmail dot com
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dcb314 at hotmail dot com @ 2023-01-12 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> The code is undefined ...
> 
>   func_23(l_26[1]);
> 
> func_23(struct S0 p_24, struct S0 p_25)

Interesting. It looks like the reduction has not preserved the two
parameters required of func_23.

From the original csmith produced code:

$ fgrep func_23 bug873.c
static union U2 * func_23(struct S0 p_24, const struct S1 p_25);
    if ((((*l_9) &= 0x3631L) ,
(safe_div_func_int32_t_s_s((safe_sub_func_int8_t_s_s((((safe_mod_func_uint32_t_u_u(((func_17(func_23(l_26[1],
l_27), l_9, ((*l_1367) = l_1366),
(safe_add_func_uint32_t_u_u(((safe_div_func_uint8_t_u_u(((safe_rshift_func_uint8_t_u_s((l_27.f0
> p_3), 1)) || (((safe_div_func_int64_t_s_s(p_3, p_3)) != 0x47247D4EED584808LL)
|| g_1119)), 0x21L)) > g_1165[0]), 0xB3A4A36DL)), l_27.f4.f0) <=
0x334C102EE31FC4EFLL) & p_3), g_7.f0)) & g_1165[0]) || l_1397), 0L)),
0x55B9621EL))))
static union U2 * func_23(struct S0 p_24, const struct S1 p_25)

Two parameters in the first declaration, two in the call and two in the
definition.

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

* [Bug ipa/108384] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2023-01-12 16:26 ` dcb314 at hotmail dot com
@ 2023-01-12 17:05 ` dcb314 at hotmail dot com
  2023-01-12 17:14 ` dcb314 at hotmail dot com
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dcb314 at hotmail dot com @ 2023-01-12 17:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #3)
> (In reply to Andrew Pinski from comment #2)
> > The code is undefined ...
> > 
> >   func_23(l_26[1]);
> > 
> > func_23(struct S0 p_24, struct S0 p_25)
> 
> Interesting. It looks like the reduction has not preserved the two
> parameters required of func_23.

I suspect a grep pattern could help guide the reduction.
I tried a few patterns, but didn't make any real progress.

Meanwhile, I try a bisection. Trying git hash g:0333892db367b2b9

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

* [Bug ipa/108384] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2023-01-12 17:05 ` dcb314 at hotmail dot com
@ 2023-01-12 17:14 ` dcb314 at hotmail dot com
  2023-01-12 17:19 ` dcb314 at hotmail dot com
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dcb314 at hotmail dot com @ 2023-01-12 17:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #4)
> Meanwhile, I try a bisection. Trying git hash g:0333892db367b2b9

Seems good. Trying g:d3328df5f5c9908c

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

* [Bug ipa/108384] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2023-01-12 17:14 ` dcb314 at hotmail dot com
@ 2023-01-12 17:19 ` dcb314 at hotmail dot com
  2023-01-12 17:35 ` dcb314 at hotmail dot com
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dcb314 at hotmail dot com @ 2023-01-12 17:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #5)
> (In reply to David Binderman from comment #4)
> > Meanwhile, I try a bisection. Trying git hash g:0333892db367b2b9
> 
> Seems good. Trying g:d3328df5f5c9908c

Seems good. Trying g:5b918b20d18b9cce

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

* [Bug ipa/108384] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2023-01-12 17:19 ` dcb314 at hotmail dot com
@ 2023-01-12 17:35 ` dcb314 at hotmail dot com
  2023-01-12 18:32 ` dcb314 at hotmail dot com
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dcb314 at hotmail dot com @ 2023-01-12 17:35 UTC (permalink / raw)
  To: gcc-bugs

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

David Binderman <dcb314 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mjambor at suse dot cz

--- Comment #7 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #6)
> (In reply to David Binderman from comment #5)
> > (In reply to David Binderman from comment #4)
> > > Meanwhile, I try a bisection. Trying git hash g:0333892db367b2b9
> > 
> > Seems good. Trying g:d3328df5f5c9908c
> 
> Seems good. Trying g:5b918b20d18b9cce

It appears to me that Martin Jambor's revision g:c389991432da2bcc
is the one at fault.

Adding Martin for their best opinion.

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

* [Bug ipa/108384] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2023-01-12 17:35 ` dcb314 at hotmail dot com
@ 2023-01-12 18:32 ` dcb314 at hotmail dot com
  2023-01-12 19:29 ` [Bug ipa/108384] [13 Regression] " pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: dcb314 at hotmail dot com @ 2023-01-12 18:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #4)
> I suspect a grep pattern could help guide the reduction.
> I tried a few patterns, but didn't make any real progress.

Using this pattern:

$ grep "func_23[^,]*,[^)]*)" bug873.c

I got the following reduced code:

struct S0 {
  int f0;
  short f1;
  unsigned f2 : 7;
  short f3
} func_2_l_27;
g_389;
func_23(struct S0 p_24, struct S0 p_25) {
  int *l_1051 = g_389;
  if (safe_sub_func_int16_t_s_s())
    for (;;)
      safe_lshift_func_uint8_t_u_s(p_24.f1);
  *l_1051 = p_25.f0;
}
func_2() {
  struct S0 l_26[] = {4, 5, 4, 6, 4, 5, 4, 6};
  func_23(l_26[1], func_2_l_27);
}

$ fgrep func_23 bug873.c
func_23(struct S0 p_24, struct S0 p_25) {
  func_23(l_26[1], func_2_l_27);
$

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

* [Bug ipa/108384] [13 Regression] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2023-01-12 18:32 ` dcb314 at hotmail dot com
@ 2023-01-12 19:29 ` pinskia at gcc dot gnu.org
  2023-01-12 19:30 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-12 19:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|error: conversion of        |[13 Regression] error:
                   |register to a different     |conversion of register to a
                   |size in ‘view_convert_expr’ |different size in
                   |                            |‘view_convert_expr’
   Last reconfirmed|                            |2023-01-12
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Target Milestone|---                         |13.0

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
Here is a cleaned up testcase where you don't need the
-ftrivial-auto-var-init=zero option either; just -O3

```
struct S0 {
  int f0;
  short f1;
  unsigned f2 : 7;
  short f3;
} func_2_l_27;
int *g_389;
int safe_sub_func_int16_t_s_s(void);
void safe_lshift_func_uint8_t_u_s(int);
void func_23(struct S0 p_24, struct S0 p_25) {
  int *l_1051 = g_389;
  if (safe_sub_func_int16_t_s_s())
    for (;;)
      safe_lshift_func_uint8_t_u_s(p_24.f1);
  *l_1051 = p_25.f0;
}
void func_2(void) {
  struct S0 l_26[] = {4, 5, 4, 6, 4, 5, 4, 6};
  __builtin_clear_padding (&l_26);
  func_23(l_26[1], func_2_l_27);
}
```

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

* [Bug ipa/108384] [13 Regression] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (8 preceding siblings ...)
  2023-01-12 19:29 ` [Bug ipa/108384] [13 Regression] " pinskia at gcc dot gnu.org
@ 2023-01-12 19:30 ` jakub at gcc dot gnu.org
  2023-01-12 19:43 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-12 19:30 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If it is __builtin_clear_padding only, I'll have a look...

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

* [Bug ipa/108384] [13 Regression] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (9 preceding siblings ...)
  2023-01-12 19:30 ` jakub at gcc dot gnu.org
@ 2023-01-12 19:43 ` pinskia at gcc dot gnu.org
  2023-01-12 21:11 ` jamborm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-12 19:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #10)
> If it is __builtin_clear_padding only, I'll have a look...

After the __builtin_clear_padding is exposed and before the IPA passes, the IR
looks like:

  l_26[1].f0 = 4;
  MEM <long int> [(struct S0[2] *)&l_26 + 16B] = 25770065925;
  func_23 (l_26[1], func_2_l_27);

So here is another testcase which you can reproduce it with -O3
-fno-strict-aliasing (because I voilate aliasing rules to get a similar enough
IR):
```
struct S0 {
  int f0;
  short f1;
  unsigned f2 : 7;
  short f3;
} func_2_l_27;
int *g_389;
int safe_sub_func_int16_t_s_s(void);
void safe_lshift_func_uint8_t_u_s(int);
void func_23(struct S0 p_24, struct S0 p_25) {
  int *l_1051 = g_389;
  if (safe_sub_func_int16_t_s_s())
    for (;;)
      safe_lshift_func_uint8_t_u_s(p_24.f1);
  *l_1051 = p_25.f0;
}
void func_2(void) {
  struct S0 l_26[2];
  l_26[1].f0 = 4;
  ((long long*)&l_26)[2] = 25770065925;
  func_23(l_26[1], func_2_l_27);
}
```

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

* [Bug ipa/108384] [13 Regression] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (10 preceding siblings ...)
  2023-01-12 19:43 ` pinskia at gcc dot gnu.org
@ 2023-01-12 21:11 ` jamborm at gcc dot gnu.org
  2023-01-13  7:26 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: jamborm at gcc dot gnu.org @ 2023-01-12 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jamborm at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jamborm at gcc dot gnu.org

--- Comment #12 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Looks like V_C_E insertion by ipa_param_body_adjustments needs to be more
careful.  Let me have a look.

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

* [Bug ipa/108384] [13 Regression] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (11 preceding siblings ...)
  2023-01-12 21:11 ` jamborm at gcc dot gnu.org
@ 2023-01-13  7:26 ` rguenth at gcc dot gnu.org
  2023-02-02 16:20 ` jamborm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-13  7:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug ipa/108384] [13 Regression] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (12 preceding siblings ...)
  2023-01-13  7:26 ` rguenth at gcc dot gnu.org
@ 2023-02-02 16:20 ` jamborm at gcc dot gnu.org
  2023-02-03 12:30 ` cvs-commit at gcc dot gnu.org
  2023-02-03 12:33 ` jamborm at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: jamborm at gcc dot gnu.org @ 2023-02-02 16:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Martin Jambor <jamborm at gcc dot gnu.org> ---
I have proposed a fix on the mailing list:

https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611194.html

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

* [Bug ipa/108384] [13 Regression] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (13 preceding siblings ...)
  2023-02-02 16:20 ` jamborm at gcc dot gnu.org
@ 2023-02-03 12:30 ` cvs-commit at gcc dot gnu.org
  2023-02-03 12:33 ` jamborm at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-03 12:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Jambor <jamborm@gcc.gnu.org>:

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

commit r13-5681-ge8109bd87766be88e83fe88a44433dae16358a02
Author: Martin Jambor <mjambor@suse.cz>
Date:   Fri Feb 3 13:28:24 2023 +0100

    ipa: Avoid invalid gimple when IPA-CP and IPA-SRA disagree on types
(108384)

    When the compiled program contains type mismatches between callers and
    callees when it comes to a parameter, IPA-CP can try to propagate one
    constant from callers while IPA-SRA may try to split a parameter
    expecting a value of a different size on the same offset.  This then
    currently leads to creation of a VIEW_CONVERT_EXPR with mismatching
    type sizes of LHS and RHS which is correctly flagged by the GIMPLE
    verifier as invalid.

    It seems that the best course of action is to try and avoid the
    situation altogether and so this patch adds a check to IPA-SRA that
    peeks into the result of IPA-CP and when it sees a value on the same
    offset but with a mismatching size, it just decides to leave that
    particular parameter be.

    gcc/ChangeLog:

    2023-02-02  Martin Jambor  <mjambor@suse.cz>

            PR ipa/108384
            * ipa-sra.cc (push_param_adjustments_for_index): Remove a size
check
            when comparing to an IPA-CP value.
            (dump_list_of_param_indices): New function.
            (adjust_parameter_descriptions): Check for mismatching IPA-CP
values.
            Dump removed candidates using dump_list_of_param_indices.
            * ipa-param-manipulation.cc
            (ipa_param_body_adjustments::modify_expression): Add assert
checking
            sizes of a VIEW_CONVERT_EXPR will match.
            (ipa_param_body_adjustments::modify_assignment): Likewise.

    gcc/testsuite/ChangeLog:

    2023-02-02  Martin Jambor  <mjambor@suse.cz>

            PR ipa/108384
            * gcc.dg/ipa/pr108384.c: New test.

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

* [Bug ipa/108384] [13 Regression] error: conversion of register to a different size in ‘view_convert_expr’
  2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
                   ` (14 preceding siblings ...)
  2023-02-03 12:30 ` cvs-commit at gcc dot gnu.org
@ 2023-02-03 12:33 ` jamborm at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: jamborm at gcc dot gnu.org @ 2023-02-03 12:33 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

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

--- Comment #15 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Fixed, thanks for reporting.

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

end of thread, other threads:[~2023-02-03 12:33 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 14:53 [Bug c/108384] New: error: conversion of register to a different size in ‘view_convert_expr’ dcb314 at hotmail dot com
2023-01-12 14:56 ` [Bug c/108384] " dcb314 at hotmail dot com
2023-01-12 16:11 ` [Bug ipa/108384] " pinskia at gcc dot gnu.org
2023-01-12 16:26 ` dcb314 at hotmail dot com
2023-01-12 17:05 ` dcb314 at hotmail dot com
2023-01-12 17:14 ` dcb314 at hotmail dot com
2023-01-12 17:19 ` dcb314 at hotmail dot com
2023-01-12 17:35 ` dcb314 at hotmail dot com
2023-01-12 18:32 ` dcb314 at hotmail dot com
2023-01-12 19:29 ` [Bug ipa/108384] [13 Regression] " pinskia at gcc dot gnu.org
2023-01-12 19:30 ` jakub at gcc dot gnu.org
2023-01-12 19:43 ` pinskia at gcc dot gnu.org
2023-01-12 21:11 ` jamborm at gcc dot gnu.org
2023-01-13  7:26 ` rguenth at gcc dot gnu.org
2023-02-02 16:20 ` jamborm at gcc dot gnu.org
2023-02-03 12:30 ` cvs-commit at gcc dot gnu.org
2023-02-03 12:33 ` jamborm 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).