public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union
@ 2012-06-13 22:47 brendan.jones.it at gmail dot com
  2012-06-13 23:20 ` [Bug tree-optimization/53663] " pinskia at gcc dot gnu.org
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: brendan.jones.it at gmail dot com @ 2012-06-13 22:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

             Bug #: 53663
           Summary: 4.7 inconsistent inline handling of bool within union
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: brendan.jones.it@gmail.com


Please refer to the following:

/* -*- Mode: C ; c-basic-offset: 4 -*- */
/* gcc test_jack.c -Wall -Wextra -o test -O1 && ./test ; echo $?
   should print 0, prints 10
   gcc known to be affected:

Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --disable-build-with-cxx
--disable-build-poststage1-with-cxx --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-initfini-array --enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.7.0 20120507 (Red Hat 4.7.0-5) (GCC) 
*/
#include <stdio.h>
union u
{
    int i = 0;
    _Bool b = 0;
};

void f(union u * vp, union u v)
{
    *vp = v;
}

int main()
{
    union u v = 0;
    union u v1 = 0;
    union u v2 = 0;

    v.i = 10;
    f(&v1, v);

    v.b = 0;
    f(&v2, v);
    if (v2.b) printf("True\n");
    else printf("False\n");
    return v2.b;
}


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

* [Bug tree-optimization/53663] 4.7 inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
@ 2012-06-13 23:20 ` pinskia at gcc dot gnu.org
  2012-06-14  8:41 ` rguenth at gcc dot gnu.org
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-06-13 23:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |tree-optimization

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-06-13 23:19:40 UTC ---
I bet this was already fixed in 4.7.1 though I have not tested it yet.


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

* [Bug tree-optimization/53663] 4.7 inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
  2012-06-13 23:20 ` [Bug tree-optimization/53663] " pinskia at gcc dot gnu.org
@ 2012-06-14  8:41 ` rguenth at gcc dot gnu.org
  2012-06-14  9:01 ` brendan.jones.it at gmail dot com
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-14  8:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-06-14
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-14 08:40:43 UTC ---
The testcase does not compile for me, it has errors:

> /space/rguenther/install/gcc-4.7.0/bin/gcc t.c -Wall -Wextra -o t -O1
t.c:4:11: error: expected ':', ',', ';', '}' or '__attribute__' before '='
token
t.c: In function 'main':
t.c:15:11: error: invalid initializer
t.c:16:11: error: invalid initializer
t.c:17:11: error: invalid initializer
t.c:19:6: error: 'union u' has no member named 'i'
t.c:22:6: error: 'union u' has no member named 'b'
t.c:24:11: error: 'union u' has no member named 'b'
t.c:26:14: error: 'union u' has no member named 'b'
t.c:27:1: warning: control reaches end of non-void function [-Wreturn-type]


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

* [Bug tree-optimization/53663] 4.7 inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
  2012-06-13 23:20 ` [Bug tree-optimization/53663] " pinskia at gcc dot gnu.org
  2012-06-14  8:41 ` rguenth at gcc dot gnu.org
@ 2012-06-14  9:01 ` brendan.jones.it at gmail dot com
  2012-06-24  7:57 ` brendan.jones.it at gmail dot com
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: brendan.jones.it at gmail dot com @ 2012-06-14  9:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

--- Comment #3 from brendan.jones.it at gmail dot com 2012-06-14 09:00:37 UTC ---
Sorry - wrong file

/* -*- Mode: C ; c-basic-offset: 4 -*- */
/* gcc test.c -Wall -Wextra -o test -O1 && ./test ; echo $?
   should print 0, prints 10
   gcc known to be affected:

Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --disable-build-with-cxx
--disable-build-poststage1-with-cxx --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-initfini-array --enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.7.0 20120507 (Red Hat 4.7.0-5) (GCC) 
*/

union u
{
    int i;
    _Bool b;
};

void f(union u * vp, union u v)
{
    *vp = v;
}

int main()
{
    union u v;
    union u v1;
    union u v2;

    v.i = 10;
    f(&v1, v);

    v.b = 0;
    f(&v2, v);
    return v2.b;
}


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

* [Bug tree-optimization/53663] 4.7 inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (2 preceding siblings ...)
  2012-06-14  9:01 ` brendan.jones.it at gmail dot com
@ 2012-06-24  7:57 ` brendan.jones.it at gmail dot com
  2012-09-23 10:01 ` fdziarmagowski at gmail dot com
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: brendan.jones.it at gmail dot com @ 2012-06-24  7:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

--- Comment #4 from brendan.jones.it at gmail dot com 2012-06-24 07:56:59 UTC ---
Hi,

have you been able to replicate this issue with the second example I have sent?

If so is there a known workaround that we can use?

many thanks

Brendan


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

* [Bug tree-optimization/53663] 4.7 inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (3 preceding siblings ...)
  2012-06-24  7:57 ` brendan.jones.it at gmail dot com
@ 2012-09-23 10:01 ` fdziarmagowski at gmail dot com
  2012-09-23 11:57 ` mikpe at it dot uu.se
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: fdziarmagowski at gmail dot com @ 2012-09-23 10:01 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

Frzderzk Dziarmagowski <fdziarmagowski at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fdziarmagowski at gmail dot
                   |                            |com

--- Comment #5 from Frzderzk Dziarmagowski <fdziarmagowski at gmail dot com> 2012-09-23 10:01:02 UTC ---
The bug is WAITING for 3 months already. Could it be possible to verify it? The
problem is affecting wide range of jack-audio users.


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

* [Bug tree-optimization/53663] 4.7 inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (4 preceding siblings ...)
  2012-09-23 10:01 ` fdziarmagowski at gmail dot com
@ 2012-09-23 11:57 ` mikpe at it dot uu.se
  2012-09-23 17:14 ` mikpe at it dot uu.se
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mikpe at it dot uu.se @ 2012-09-23 11:57 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu.se

--- Comment #6 from Mikael Pettersson <mikpe at it dot uu.se> 2012-09-23 11:56:50 UTC ---
I can reproduce the wrong-code with gcc 4.7-20120922 and 4.8-20120916, at -O1,
on x86_64-linux. -O2 avoids the wrong-code, but if I replace the "*vp = v" with
the equivalent __builtin_memcpy() then -O2 also generates wrong code. gcc-4.6
seems to work correctly.


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

* [Bug tree-optimization/53663] 4.7 inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (5 preceding siblings ...)
  2012-09-23 11:57 ` mikpe at it dot uu.se
@ 2012-09-23 17:14 ` mikpe at it dot uu.se
  2012-09-23 18:45 ` mikpe at it dot uu.se
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mikpe at it dot uu.se @ 2012-09-23 17:14 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

Mikael Pettersson <mikpe at it dot uu.se> changed:

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

--- Comment #7 from Mikael Pettersson <mikpe at it dot uu.se> 2012-09-23 17:14:30 UTC ---
The regression started with Richard G's fix for PR38885 in r179556:
http://gcc.gnu.org/ml/gcc-cvs/2011-10/msg00150.html
http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00326.html

It may be yet another SRA problem.


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

* [Bug tree-optimization/53663] 4.7 inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (6 preceding siblings ...)
  2012-09-23 17:14 ` mikpe at it dot uu.se
@ 2012-09-23 18:45 ` mikpe at it dot uu.se
  2012-09-23 19:52 ` fdziarmagowski at gmail dot com
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mikpe at it dot uu.se @ 2012-09-23 18:45 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

--- Comment #8 from Mikael Pettersson <mikpe at it dot uu.se> 2012-09-23 18:44:53 UTC ---
(In reply to comment #7)
> It may be yet another SRA problem.

Perhaps not, -fno-tree-sra makes no difference.  Looking through the tree dumps
I see the wrong code first appearing in the .fre1 dump.  Compiling with -O1
-fno-tree-fre does avoid the wrong code.


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

* [Bug tree-optimization/53663] 4.7 inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (7 preceding siblings ...)
  2012-09-23 18:45 ` mikpe at it dot uu.se
@ 2012-09-23 19:52 ` fdziarmagowski at gmail dot com
  2012-09-23 22:12 ` mikpe at it dot uu.se
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: fdziarmagowski at gmail dot com @ 2012-09-23 19:52 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

--- Comment #9 from Frzderzk Dziarmagowski <fdziarmagowski at gmail dot com> 2012-09-23 19:52:29 UTC ---
Confirmed, jackd compiled with -O1 -fno-tree-fre works as expected


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

* [Bug tree-optimization/53663] 4.7 inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (8 preceding siblings ...)
  2012-09-23 19:52 ` fdziarmagowski at gmail dot com
@ 2012-09-23 22:12 ` mikpe at it dot uu.se
  2012-09-24  7:18 ` [Bug tree-optimization/53663] [4.7/4.8 Regression] " jakub at gcc dot gnu.org
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mikpe at it dot uu.se @ 2012-09-23 22:12 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

--- Comment #10 from Mikael Pettersson <mikpe at it dot uu.se> 2012-09-23 22:12:07 UTC ---
Although -fno-tree-fre works for the test case in #c3, adjusting it to use
__builtin_memcpy() for the assignment in f() results in wrong code even with
-fno-tree-fre.

The bug seems _Bool-specific. Replacing the _Bool with unsigned char b:1 gives
working code regardless of compiler options.


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

* [Bug tree-optimization/53663] [4.7/4.8 Regression] inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (9 preceding siblings ...)
  2012-09-23 22:12 ` mikpe at it dot uu.se
@ 2012-09-24  7:18 ` jakub at gcc dot gnu.org
  2012-09-24  9:08 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-09-24  7:18 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |jakub at gcc dot gnu.org
            Version|unknown                     |4.7.2
   Target Milestone|---                         |4.7.3
            Summary|4.7 inconsistent inline     |[4.7/4.8 Regression]
                   |handling of bool within     |inconsistent inline
                   |union                       |handling of bool within
                   |                            |union


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

* [Bug tree-optimization/53663] [4.7/4.8 Regression] inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (10 preceding siblings ...)
  2012-09-24  7:18 ` [Bug tree-optimization/53663] [4.7/4.8 Regression] " jakub at gcc dot gnu.org
@ 2012-09-24  9:08 ` rguenth at gcc dot gnu.org
  2012-09-24  9:15 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-24  9:08 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-24 09:08:17 UTC ---
Mine.


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

* [Bug tree-optimization/53663] [4.7/4.8 Regression] inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (11 preceding siblings ...)
  2012-09-24  9:08 ` rguenth at gcc dot gnu.org
@ 2012-09-24  9:15 ` jakub at gcc dot gnu.org
  2012-09-24 11:45 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-09-24  9:15 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-09-24 09:14:31 UTC ---
Guess for BOOLEAN_TYPE in unions we can't look just at the single bit, but also
all other bits of the boolean type, because we rely that the bool doesn't
contain other values than false/true.


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

* [Bug tree-optimization/53663] [4.7/4.8 Regression] inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (12 preceding siblings ...)
  2012-09-24  9:15 ` jakub at gcc dot gnu.org
@ 2012-09-24 11:45 ` rguenth at gcc dot gnu.org
  2012-09-24 13:14 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-24 11:45 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-24 11:44:32 UTC ---
This boils down to the question whether reading a 1-bit precision quantity
from memory has to disregard the upper bits or not (I think we had similar
issues with SRA).  Thus, whether reading a _Bool from memory is a
bitfield extract or not (expansion does not treat it as bitfield extract
because the FIELD_DECLs size is 8, not 1).

We go into

  /* 3) Assignment from a constant.  We can use folds native encode/interpret
     routines to extract the assigned bits.  */

which has the issue that it doesn't work if TYPE_PRECISION is not equal
to TYPE_SIZE.  At least not for detecting redundant stores (it does work
for folding a read of v.b though).

I have a patch.


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

* [Bug tree-optimization/53663] [4.7/4.8 Regression] inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (13 preceding siblings ...)
  2012-09-24 11:45 ` rguenth at gcc dot gnu.org
@ 2012-09-24 13:14 ` rguenth at gcc dot gnu.org
  2012-09-25  7:52 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-24 13:14 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

--- Comment #14 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-24 13:14:00 UTC ---
We still want to possibly optimize

extern void abort (void);

union u
{
  int i;
  _Bool b;
};

void f(union u * vp, union u v)
{
  *vp = v;
}

int main()
{
  union u v;
  union u v1;
  union u v2;

  v.i = 0;
  f(&v1, v);

  v.b = 0;
  f(&v2, v);
  if (v2.b != 0)
    abort ();
  return 0;
}

though we might be able to trigger TBAA issues when removing a store
that would merely change the effective type (without changing the
underlying value).  Of course we try hard (on the tree level) to
make DWIM code work, but still ... thus,

 <float> = 1.;
 <int> = 0;
 <float> = 0.;
 ... = <float>;

if we remove the store <float> = 0. as redundant (it stores a value
already there) then further optimizations might re-order the float
and the int store.  We don't perform redundant store elimination here
because 0. and 0 are not operand_equal_p though - but it works for shorts.

extern void abort (void);

union u
{
  int i;
  short f;
} v;

short foo (short *f)
{
  *f = 1;
  v.i = 0;
  v.f = 0;
  return *f;
}

int main()
{
  if (foo (&v.f) != 0)
    abort ();
  return 0;
}

(still doesn't break though).


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

* [Bug tree-optimization/53663] [4.7/4.8 Regression] inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (14 preceding siblings ...)
  2012-09-24 13:14 ` rguenth at gcc dot gnu.org
@ 2012-09-25  7:52 ` rguenth at gcc dot gnu.org
  2012-09-25  7:55 ` [Bug tree-optimization/53663] [4.7 " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-25  7:52 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

--- Comment #15 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-25 07:52:01 UTC ---
Author: rguenth
Date: Tue Sep 25 07:51:51 2012
New Revision: 191694

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191694
Log:
2012-09-25  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/53663
    * tree-ssa-sccvn.c (vn_reference_lookup_3): Conditional
    native encode/interpret translation on VN_WALKREWRITE.

    * gcc.dg/torture/pr53663-1.c: New testcase.
    * gcc.dg/torture/pr53663-2.c: Likewise.
    * gcc.dg/torture/pr53663-3.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr53663-1.c
    trunk/gcc/testsuite/gcc.dg/torture/pr53663-2.c
    trunk/gcc/testsuite/gcc.dg/torture/pr53663-3.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-sccvn.c


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

* [Bug tree-optimization/53663] [4.7 Regression] inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (15 preceding siblings ...)
  2012-09-25  7:52 ` rguenth at gcc dot gnu.org
@ 2012-09-25  7:55 ` rguenth at gcc dot gnu.org
  2012-09-25  8:31 ` fdziarmagowski at gmail dot com
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-25  7:55 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.8.0
            Summary|[4.7/4.8 Regression]        |[4.7 Regression]
                   |inconsistent inline         |inconsistent inline
                   |handling of bool within     |handling of bool within
                   |union                       |union
      Known to fail|                            |4.7.2

--- Comment #16 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-25 07:55:30 UTC ---
Fixed on trunk sofar.


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

* [Bug tree-optimization/53663] [4.7 Regression] inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (16 preceding siblings ...)
  2012-09-25  7:55 ` [Bug tree-optimization/53663] [4.7 " rguenth at gcc dot gnu.org
@ 2012-09-25  8:31 ` fdziarmagowski at gmail dot com
  2012-12-03 15:34 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: fdziarmagowski at gmail dot com @ 2012-09-25  8:31 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

--- Comment #17 from Fryderyk Dziarmagowski <fdziarmagowski at gmail dot com> 2012-09-25 08:31:25 UTC ---
With above fix 4.7.2 works as expected too.


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

* [Bug tree-optimization/53663] [4.7 Regression] inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (17 preceding siblings ...)
  2012-09-25  8:31 ` fdziarmagowski at gmail dot com
@ 2012-12-03 15:34 ` rguenth at gcc dot gnu.org
  2012-12-03 16:54 ` rguenth at gcc dot gnu.org
  2012-12-03 16:54 ` rguenth at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-03 15:34 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Priority|P3                          |P2


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

* [Bug tree-optimization/53663] [4.7 Regression] inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (19 preceding siblings ...)
  2012-12-03 16:54 ` rguenth at gcc dot gnu.org
@ 2012-12-03 16:54 ` rguenth at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-03 16:54 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

--- Comment #18 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-03 16:53:39 UTC ---
Author: rguenth
Date: Mon Dec  3 16:53:25 2012
New Revision: 194101

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194101
Log:
2012-12-03  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2012-09-24  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/53663
    * tree-ssa-sccvn.c (vn_reference_lookup_3): Conditional
    native encode/interpret translation on VN_WALKREWRITE.

    * gcc.dg/torture/pr53663-1.c: New testcase.
    * gcc.dg/torture/pr53663-2.c: Likewise.
    * gcc.dg/torture/pr53663-3.c: Likewise.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr53663-1.c
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr53663-2.c
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr53663-3.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/gcc/tree-ssa-sccvn.c


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

* [Bug tree-optimization/53663] [4.7 Regression] inconsistent inline handling of bool within union
  2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
                   ` (18 preceding siblings ...)
  2012-12-03 15:34 ` rguenth at gcc dot gnu.org
@ 2012-12-03 16:54 ` rguenth at gcc dot gnu.org
  2012-12-03 16:54 ` rguenth at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-03 16:54 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663

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

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

--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-03 16:54:13 UTC ---
Fixed.


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

end of thread, other threads:[~2012-12-03 16:54 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-13 22:47 [Bug c/53663] New: 4.7 inconsistent inline handling of bool within union brendan.jones.it at gmail dot com
2012-06-13 23:20 ` [Bug tree-optimization/53663] " pinskia at gcc dot gnu.org
2012-06-14  8:41 ` rguenth at gcc dot gnu.org
2012-06-14  9:01 ` brendan.jones.it at gmail dot com
2012-06-24  7:57 ` brendan.jones.it at gmail dot com
2012-09-23 10:01 ` fdziarmagowski at gmail dot com
2012-09-23 11:57 ` mikpe at it dot uu.se
2012-09-23 17:14 ` mikpe at it dot uu.se
2012-09-23 18:45 ` mikpe at it dot uu.se
2012-09-23 19:52 ` fdziarmagowski at gmail dot com
2012-09-23 22:12 ` mikpe at it dot uu.se
2012-09-24  7:18 ` [Bug tree-optimization/53663] [4.7/4.8 Regression] " jakub at gcc dot gnu.org
2012-09-24  9:08 ` rguenth at gcc dot gnu.org
2012-09-24  9:15 ` jakub at gcc dot gnu.org
2012-09-24 11:45 ` rguenth at gcc dot gnu.org
2012-09-24 13:14 ` rguenth at gcc dot gnu.org
2012-09-25  7:52 ` rguenth at gcc dot gnu.org
2012-09-25  7:55 ` [Bug tree-optimization/53663] [4.7 " rguenth at gcc dot gnu.org
2012-09-25  8:31 ` fdziarmagowski at gmail dot com
2012-12-03 15:34 ` rguenth at gcc dot gnu.org
2012-12-03 16:54 ` rguenth at gcc dot gnu.org
2012-12-03 16:54 ` 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).