public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code
@ 2014-07-11 16:23 zeccav at gmail dot com
  2014-07-14 11:40 ` [Bug c/61779] " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: zeccav at gmail dot com @ 2014-07-11 16:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61779
           Summary: gcc -Og fails with impossible constraint on legal C
                    code
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zeccav at gmail dot com

Created attachment 33108
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33108&action=edit
Same code as in the bug Description

The following code compiles fine without the -Og option.
Compiled with -Og gcc fails.

/* gcc -Og error: impossible constraint in ‘asm’ */
extern unsigned long long __sdt_unsp;
void
f(void)
{
 for (;;)
  __asm__ (".pushsection .note.stapsdt" "," "\"?\"" "," "\"note\"" "\n" ".4byte
992f-991f" "," "994f-993f" "," "3" "\n" ".asciz \"%n[_SDT_S1]@%[_SDT_A1]\""
"\n" :: [_SDT_S1] "n" (((!__extension__ (__builtin_constant_p ((((unsigned long
long) (__typeof (__builtin_choose_expr (((__builtin_classify_type (0) + 3) &
-4) == 4, (0), 0U))) __sdt_unsp) ) == 0) )) ? 1 : -1) ), [_SDT_A1] "nor"
((0)));
}
>From gcc-bugs-return-456124-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jul 11 16:26:21 2014
Return-Path: <gcc-bugs-return-456124-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6108 invoked by alias); 11 Jul 2014 16:26:20 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 5969 invoked by uid 48); 11 Jul 2014 16:26:11 -0000
From: "zeccav at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
Date: Fri, 11 Jul 2014 16:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.9.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: zeccav at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61779-4-JS6v2EU9Ov@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61779-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61779-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-07/txt/msg00715.txt.bz2
Content-length: 192

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida779

--- Comment #1 from Vittorio Zecca <zeccav at gmail dot com> ---
I forgot to say that gcc 4.9.0 fails but compiles correctly on gcc 4.8.3.


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

* [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
  2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
@ 2014-07-14 11:40 ` rguenth at gcc dot gnu.org
  2014-07-14 13:53 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-14 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-07-14
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
f ()
{
  int iftmp.0_1;

  <bb 2>:

  <bb 3>:

  <bb 4>:
  # iftmp.0_1 = PHI <1(3)>
  __asm__ __volatile__(".pushsection .note.stapsdt,"?","note"
.4byte 992f-991f,994f-993f,3
.asciz "%n0@%1"
" :  : "_SDT_S1" "n" iftmp.0_1, "_SDT_A1" "nor" 0);
  goto <bb 3>;


Huh.  At -O0 we have the constant 1 propagated.  From folding builtins
we get

  _7 = 0;
  if (_7 == 0)
    goto <bb 5>;
  else
    goto <bb 4>;

  <bb 4>:

  <bb 5>:
  # iftmp.0_1 = PHI <1(3), -1(4)>

and copyprop then produces

  <bb 4>:
  # iftmp.0_1 = PHI <1(3)>

because copyprop does

Visiting statement:
if (_7 == 0)

No interesting values produced.

Adding Destination of edge (3 -> 5) to worklist

Adding Destination of edge (3 -> 4) to worklist

err.  Since copyprop also copy-propagates constants copy_prop_visit_cond_stmt
should try harder.

Mine.


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

* [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
  2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
  2014-07-14 11:40 ` [Bug c/61779] " rguenth at gcc dot gnu.org
@ 2014-07-14 13:53 ` rguenth at gcc dot gnu.org
  2014-07-15  7:51 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-14 13:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Mon Jul 14 13:52:38 2014
New Revision: 212521

URL: https://gcc.gnu.org/viewcvs?rev=212521&root=gcc&view=rev
Log:
2014-07-14  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/61779
    * tree-ssa-copy.c (copy_prop_visit_cond_stmt): Always try
    simplifying a condition.

    * gcc.dg/tree-ssa/ssa-copyprop-2.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-copy.c


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

* [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
  2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
  2014-07-14 11:40 ` [Bug c/61779] " rguenth at gcc dot gnu.org
  2014-07-14 13:53 ` rguenth at gcc dot gnu.org
@ 2014-07-15  7:51 ` rguenth at gcc dot gnu.org
  2014-07-15 10:03 ` zeccav at gmail dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-15  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.10.0
      Known to fail|                            |4.8.3, 4.9.1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for 4.10 sofar.


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

* [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
  2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
                   ` (2 preceding siblings ...)
  2014-07-15  7:51 ` rguenth at gcc dot gnu.org
@ 2014-07-15 10:03 ` zeccav at gmail dot com
  2014-07-15 10:13 ` rguenther at suse dot de
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zeccav at gmail dot com @ 2014-07-15 10:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Vittorio Zecca <zeccav at gmail dot com> ---
I just applied your fix and now gcc compiles succesfully with -Og.


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

* [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
  2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
                   ` (3 preceding siblings ...)
  2014-07-15 10:03 ` zeccav at gmail dot com
@ 2014-07-15 10:13 ` rguenther at suse dot de
  2014-07-15 15:05 ` zeccav at gmail dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenther at suse dot de @ 2014-07-15 10:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 15 Jul 2014, zeccav at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61779
> 
> --- Comment #5 from Vittorio Zecca <zeccav at gmail dot com> ---
> I just applied your fix and now gcc compiles succesfully with -Og.

Thanks for the feedback on -Og btw - it hasn't seen very much
testing coverage yet.  Probably because the advertised fast
compile-time is still much slower than with -O0.


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

* [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
  2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
                   ` (4 preceding siblings ...)
  2014-07-15 10:13 ` rguenther at suse dot de
@ 2014-07-15 15:05 ` zeccav at gmail dot com
  2014-07-17  7:53 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zeccav at gmail dot com @ 2014-07-15 15:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Vittorio Zecca <zeccav at gmail dot com> ---
I forgot to mention that my code fragment comes from

#include <sys/sdt.h>
void
f(void)
{
 for (;;)
  _SDT_PROBE(0, 0, 1,(0));
}

Maybe you can find intelligent ways to exercise this code and find
more -Og bugs?


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

* [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
  2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
                   ` (6 preceding siblings ...)
  2014-07-17  7:53 ` rguenth at gcc dot gnu.org
@ 2014-07-17  7:53 ` rguenth at gcc dot gnu.org
  2014-07-24 14:38 ` zeccav at gmail dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-17  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |4.9.2
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.2

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for 4.9.2.


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

* [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
  2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
                   ` (5 preceding siblings ...)
  2014-07-15 15:05 ` zeccav at gmail dot com
@ 2014-07-17  7:53 ` rguenth at gcc dot gnu.org
  2014-07-17  7:53 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-17  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Thu Jul 17 07:53:16 2014
New Revision: 212741

URL: https://gcc.gnu.org/viewcvs?rev=212741&root=gcc&view=rev
Log:
2014-07-17  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2014-07-14  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/61779
    * tree-ssa-copy.c (copy_prop_visit_cond_stmt): Always try
    simplifying a condition.

    * gcc.dg/tree-ssa/ssa-copyprop-2.c: New testcase.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_9-branch/gcc/tree-ssa-copy.c


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

* [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
  2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
                   ` (7 preceding siblings ...)
  2014-07-17  7:53 ` rguenth at gcc dot gnu.org
@ 2014-07-24 14:38 ` zeccav at gmail dot com
  2014-07-25  9:38 ` rguenth at gcc dot gnu.org
  2014-07-25 11:48 ` zeccav at gmail dot com
  10 siblings, 0 replies; 12+ messages in thread
From: zeccav at gmail dot com @ 2014-07-24 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Vittorio Zecca <zeccav at gmail dot com> ---
I just installed gcc-4.9.1 and it still has this bug.
It does not even compile itself (divtf3.c) with -Og.


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

* [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
  2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
                   ` (8 preceding siblings ...)
  2014-07-24 14:38 ` zeccav at gmail dot com
@ 2014-07-25  9:38 ` rguenth at gcc dot gnu.org
  2014-07-25 11:48 ` zeccav at gmail dot com
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-07-25  9:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Vittorio Zecca from comment #10)
> I just installed gcc-4.9.1 and it still has this bug.
> It does not even compile itself (divtf3.c) with -Og.

As said it will be fixed in 4.9.2.  I've double-checked that -Og bootstrap
works on the 4.9 branch head - how did you configure/make?


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

* [Bug c/61779] gcc -Og fails with impossible constraint on legal C code
  2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
                   ` (9 preceding siblings ...)
  2014-07-25  9:38 ` rguenth at gcc dot gnu.org
@ 2014-07-25 11:48 ` zeccav at gmail dot com
  10 siblings, 0 replies; 12+ messages in thread
From: zeccav at gmail dot com @ 2014-07-25 11:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Vittorio Zecca <zeccav at gmail dot com> ---
Yes, you did say it will be fixed in 4.9.2. Sorry.
I did:
export CFLAGS="-ggdb -Og"
export CXXFLAGS=$CFLAGS
../gcc-4.9.1/configure --prefix=/home/vitti/local/gcc-4.9.1
--disable-lto --with-tune=k8 --enable-languages=c,c++,fortran

I compiled manually divtf3.c without -Og.


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

end of thread, other threads:[~2014-07-25 11:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-11 16:23 [Bug c/61779] New: gcc -Og fails with impossible constraint on legal C code zeccav at gmail dot com
2014-07-14 11:40 ` [Bug c/61779] " rguenth at gcc dot gnu.org
2014-07-14 13:53 ` rguenth at gcc dot gnu.org
2014-07-15  7:51 ` rguenth at gcc dot gnu.org
2014-07-15 10:03 ` zeccav at gmail dot com
2014-07-15 10:13 ` rguenther at suse dot de
2014-07-15 15:05 ` zeccav at gmail dot com
2014-07-17  7:53 ` rguenth at gcc dot gnu.org
2014-07-17  7:53 ` rguenth at gcc dot gnu.org
2014-07-24 14:38 ` zeccav at gmail dot com
2014-07-25  9:38 ` rguenth at gcc dot gnu.org
2014-07-25 11:48 ` zeccav at gmail dot com

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).