public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line
@ 2013-05-13 13:32 thutt at vmware dot com
  2013-05-13 15:41 ` [Bug target/57264] " ubizjak at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: thutt at vmware dot com @ 2013-05-13 13:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57264
           Summary: cld not emitted when string instructions used, and
                    '-mcld' on command line
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thutt at vmware dot com

A defect has been found in several versions of gcc with respect to the
'-mcld' option.

  -mcld

     This option instructs GCC to emit a "cld" instruction in the
     prologue of functions that use string instructions.  String
     instructions depend on the DF flag to select between
     autoincrement or autodecrement mode.  While the ABI specifies the
     DF flag to be cleared on function entry, some operating systems
     violate this specification by not clearing the DF flag in their
     exception dispatchers.  The exception handler can be invoked with
     the DF flag set which leads to wrong direction mode, when string
     instructions are used.  This option can be enabled by default on
     32-bit x86 targets by configuring GCC with the --enable-cld
     configure option.  Generation of "cld" instructions can be
     suppressed with the -mno-cld compiler option in this case.


Consider the following distillation of the issue (cld.c):

  void test(int x, int **pp)
  {
      while (x) {
          int *ip = *pp;
          int *op = *pp;
          while (*ip) {
             int v = *ip++;
             *op++ = v + 1;
          }
       }
  }

To demonstrate the issue:

  gcc -c -mcld -O1 -m64 -o cld.o cld.c
  objdump --disassemble --reloc cld.o

An example failure case:

  gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
  Copyright (C) 2011 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


  0000000000000000 <test>:
     0:  85 ff                  test   %edi,%edi
     2:  74 15                  je     19 <test+0x19>
     4:  48 8b 3e               mov    (%rsi),%rdi
     7:  8b 07                  mov    (%rdi),%eax
     9:  85 c0                  test   %eax,%eax
     b:  74 f7                  je     4 <test+0x4>
     d:  83 c0 01               add    $0x1,%eax
    10:  ab                     stos   %eax,%es:(%rdi)
    11:  8b 07                  mov    (%rdi),%eax
    13:  85 c0                  test   %eax,%eax
    15:  74 ed                  je     4 <test+0x4>
    17:  eb f4                  jmp    d <test+0xd>
    19:  f3 c3                  repz retq

For the above sample code, local experimentation has shown than 4.5,
4.6 & 4.7 emit a string instruction without a 'cld' in the prologue.
Versions 4.4 & 4.8 do not emit a string instruction.

Most perturbations to the above sample code will change the output so
that no string instruction is emitted when using the defective
versions.

It is expected that a 'cld' instruction will be generated in the
function prolong whenever any string instruction is emitted by gcc when
the '-mcld' option has been provided.


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

* [Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line
  2013-05-13 13:32 [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line thutt at vmware dot com
@ 2013-05-13 15:41 ` ubizjak at gmail dot com
  2013-05-13 15:56 ` ubizjak at gmail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2013-05-13 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86
             Status|UNCONFIRMED                 |NEW
            Version|unknown                     |4.7.3
   Last reconfirmed|                            |2013-05-13
          Component|c                           |target
                 CC|                            |ubizjak at gmail dot com
     Ever confirmed|0                           |1
   Target Milestone|---                         |4.7.4

--- Comment #1 from Uros Bizjak <ubizjak at gmail dot com> ---
The stosl insn is created by the combine pass, not via expander, so flag that
triggers the cld insertion is not set. I propose to backport r195381 to disable
unwanted insn combination.

Can you please test the backport?


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

* [Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line
  2013-05-13 13:32 [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line thutt at vmware dot com
  2013-05-13 15:41 ` [Bug target/57264] " ubizjak at gmail dot com
@ 2013-05-13 15:56 ` ubizjak at gmail dot com
  2013-05-13 17:26 ` ubizjak at gmail dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2013-05-13 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ubizjak at gmail dot com

--- Comment #2 from Uros Bizjak <ubizjak at gmail dot com> ---
I am preparing the backport.


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

* [Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line
  2013-05-13 13:32 [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line thutt at vmware dot com
  2013-05-13 15:41 ` [Bug target/57264] " ubizjak at gmail dot com
  2013-05-13 15:56 ` ubizjak at gmail dot com
@ 2013-05-13 17:26 ` ubizjak at gmail dot com
  2013-05-13 17:28 ` ubizjak at gmail dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2013-05-13 17:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Uros Bizjak <ubizjak at gmail dot com> ---
Author: uros
Date: Mon May 13 17:14:26 2013
New Revision: 198837

URL: http://gcc.gnu.org/viewcvs?rev=198837&root=gcc&view=rev
Log:
    PR target/57264
    Backport from mainline
    2013-01-22  Jakub Jelinek  <jakub@redhat.com>

    PR target/55686
    * config/i386/i386.md (UNSPEC_STOS): New.
    (strset_singleop, *strsetdi_rex_1, *strsetsi_1, *strsethi_1,
    *strsetqi_1): Add UNSPEC_STOS.

testsuite/ChangeLog:

    PR target/57264
    * gcc.target/i386/pr57264.c: New test.


Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.target/i386/pr57264.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/config/i386/i386.md
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line
  2013-05-13 13:32 [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line thutt at vmware dot com
                   ` (2 preceding siblings ...)
  2013-05-13 17:26 ` ubizjak at gmail dot com
@ 2013-05-13 17:28 ` ubizjak at gmail dot com
  2013-05-13 17:56 ` thutt at vmware dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2013-05-13 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2013-05/msg00655.htm
                   |                            |l
         Resolution|---                         |FIXED

--- Comment #4 from Uros Bizjak <ubizjak at gmail dot com> ---
Fixed in 4.7 branch by [1]. 4.5 and 4.6 branches are closed.

[1] http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00655.html


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

* [Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line
  2013-05-13 13:32 [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line thutt at vmware dot com
                   ` (3 preceding siblings ...)
  2013-05-13 17:28 ` ubizjak at gmail dot com
@ 2013-05-13 17:56 ` thutt at vmware dot com
  2013-05-13 18:54 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: thutt at vmware dot com @ 2013-05-13 17:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from thutt at vmware dot com ---
(In reply to Uros Bizjak from comment #3)
> Author: uros
> Date: Mon May 13 17:14:26 2013
> New Revision: 198837
> 
> URL: http://gcc.gnu.org/viewcvs?rev=198837&root=gcc&view=rev
> Log:
> 	PR target/57264
> 	Backport from mainline
> 	2013-01-22  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/55686
> 	* config/i386/i386.md (UNSPEC_STOS): New.
> 	(strset_singleop, *strsetdi_rex_1, *strsetsi_1, *strsethi_1,
> 	*strsetqi_1): Add UNSPEC_STOS.
> 
> testsuite/ChangeLog:
> 
> 	PR target/57264
> 	* gcc.target/i386/pr57264.c: New test.
> 
> 
> Added:
>     branches/gcc-4_7-branch/gcc/testsuite/gcc.target/i386/pr57264.c
> Modified:
>     branches/gcc-4_7-branch/gcc/ChangeLog
>     branches/gcc-4_7-branch/gcc/config/i386/i386.md
>     branches/gcc-4_7-branch/gcc/testsuite/ChangeLog

Does the same error exist in the 4.8 branch, or any other forward moving
branch?
>From gcc-bugs-return-422174-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon May 13 17:57:32 2013
Return-Path: <gcc-bugs-return-422174-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11811 invoked by alias); 13 May 2013 17:57:32 -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 9559 invoked by uid 48); 13 May 2013 17:57:02 -0000
From: "ahaas at airmail dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/57265] New: Bootstrap failure on sparc-sun-solaris2.10 in libquadmath
Date: Mon, 13 May 2013 17:57:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ahaas at airmail dot net
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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-57265-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: 2013-05/txt/msg00847.txt.bz2
Content-length: 2570

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW265

            Bug ID: 57265
           Summary: Bootstrap failure on sparc-sun-solaris2.10 in
                    libquadmath
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ahaas at airmail dot net

My builds have failed since April 15 when building 'libquadmath' after
completing the stage2/stage3 comparison. My last successful build was on April
14. The error below is taken from the 'config.log' file in  the
'sparc-sun-solaris2.10/sparcv9/libquadmath' directory:

{ ... snip ... }
configure:3386: checking whether the C compiler works
configure:3395: ./a.out
ld.so.1: a.out: fatal: /export/home/arth/src/gcc-0512/./gcc/libgcc_s.so.1:
wrong
 ELF class: ELFCLASS32
/export/home/arth/src/gcc.git/libquadmath/configure: line 3397: 11229 Killed
              ./$ac_file
configure:3399: $? = 137
configure:3406: error: in
`/export/home/arth/src/gcc-0512/sparc-sun-solaris2.10/
sparcv9/libquadmath':
configure:3410: error: cannot run C compiled programs.

A bit of git bisecting leads to this change:

commit 8aaed91dfc5f8fcd17fd6b61de3a6d68e59b5e1e
Author: ro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Apr 15 10:31:57 2013 +0000

    Use -z ignore instead of --as-needed on Solaris

        * configure.ac (gcc_cv_ld_as_needed): Set
        gcc_cv_ld_as_needed_option, gcc_cv_no_as_needed_option.
        Use -z ignore, -z record on *-*-solaris2*.
        (HAVE_LD_AS_NEEDED): Update comment.
        (LD_AS_NEEDED_OPTION, LD_NO_AS_NEEDED_OPTION): Define.
        * configure: Regenerate.
        * config.in: Regenerate.
        * gcc.c (init_gcc_specs) [USE_LD_AS_NEEDED]: Use
        LD_AS_NEEDED_OPTION, LD_NO_AS_NEEDED_OPTION.
        * config/sol2.h [HAVE_LD_AS_NEEDED] (USE_LD_AS_NEEDED): Define.
        * doc/tm.texi.in (USE_LD_AS_NEEDED): Allow for --as-needed
        equivalents.  Fix markup.
        * doc/tm.texi: Regenerate.

    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197964
138bc75d-0d04-0410-96

I'm able go get a successful build with the previous revision 197963, which is
'98c0d6572c62b325c1e8635df3d6b22003b83619' in my git checkout. In this
revision, the config.log contents from 'sparc-sun-solaris2.10/sparcv9' show
this test succeeding:

configure:3386: checking whether the C compiler works
configure:3395: ./a.out
configure:3399: $? = 0
configure:3414: result: yes

Thanks.

Art Haas


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

* [Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line
  2013-05-13 13:32 [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line thutt at vmware dot com
                   ` (4 preceding siblings ...)
  2013-05-13 17:56 ` thutt at vmware dot com
@ 2013-05-13 18:54 ` ubizjak at gmail dot com
  2013-05-14 13:41 ` thutt at vmware dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2013-05-13 18:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Uros Bizjak <ubizjak at gmail dot com> ---
(In reply to thutt from comment #5)
> 
> Does the same error exist in the 4.8 branch, or any other forward moving
> branch?

No, 4.8 and newer branches already contain the original patch.


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

* [Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line
  2013-05-13 13:32 [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line thutt at vmware dot com
                   ` (5 preceding siblings ...)
  2013-05-13 18:54 ` ubizjak at gmail dot com
@ 2013-05-14 13:41 ` thutt at vmware dot com
  2013-05-14 14:01 ` ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: thutt at vmware dot com @ 2013-05-14 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from thutt at vmware dot com ---
(In reply to Uroš Bizjak from comment #6)
> (In reply to thutt from comment #5)
> > 
> > Does the same error exist in the 4.8 branch, or any other forward moving
> > branch?
> 
> No, 4.8 and newer branches already contain the original patch.

Sorry to be a bother, but can you tell me if the issue was / is in the 4.4
branch?
>From gcc-bugs-return-422244-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 14 13:56:31 2013
Return-Path: <gcc-bugs-return-422244-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17998 invoked by alias); 14 May 2013 13:56:31 -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 17959 invoked by uid 48); 14 May 2013 13:56:28 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/53903] [C++11] Incompatible exception-specification allowed if member explicitly-defaulted after first declaration
Date: Tue, 14 May 2013 13:56: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.0
X-Bugzilla-Keywords: accepts-invalid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: paolo.carlini at oracle dot com
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status version resolution assigned_to target_milestone
Message-ID: <bug-53903-4-Ch273sf2Uf@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-53903-4@http.gcc.gnu.org/bugzilla/>
References: <bug-53903-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: 2013-05/txt/msg00917.txt.bz2
Content-length: 643

http://gcc.gnu.org/bugzilla/show_bug.cgi?idS903

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
            Version|4.7.1                       |4.9.0
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.9.0

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0.


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

* [Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line
  2013-05-13 13:32 [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line thutt at vmware dot com
                   ` (6 preceding siblings ...)
  2013-05-14 13:41 ` thutt at vmware dot com
@ 2013-05-14 14:01 ` ubizjak at gmail dot com
  2013-05-14 17:07 ` thutt at vmware dot com
  2013-05-14 18:00 ` ubizjak at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2013-05-14 14:01 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 6685 bytes --]

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

--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to thutt from comment #7)
> (In reply to Uroš Bizjak from comment #6)
> > (In reply to thutt from comment #5)
> > > 
> > > Does the same error exist in the 4.8 branch, or any other forward moving
> > > branch?
> > 
> > No, 4.8 and newer branches already contain the original patch.
> 
> Sorry to be a bother, but can you tell me if the issue was / is in the 4.4
> branch?

Yes, cld was removed in 4.3.0. Please see PR36079 that introduced -mcld.
>From gcc-bugs-return-422246-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 14 14:16:23 2013
Return-Path: <gcc-bugs-return-422246-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 1051 invoked by alias); 14 May 2013 14:16:23 -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 1027 invoked by uid 48); 14 May 2013 14:16:19 -0000
From: "ppluzhnikov at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57274] New: [4.8/4.9 Regression] Bogus sequence-point warning in C++
Date: Tue, 14 May 2013 14:16:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ppluzhnikov at google 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-57274-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-05/txt/msg00919.txt.bz2
Content-length: 864

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

            Bug ID: 57274
           Summary: [4.8/4.9 Regression] Bogus sequence-point warning in
                    C++
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Test case:


#include <unistd.h>

void fn (int *data) {
  write (1, data++, sizeof (*data));
}


Using trunk GCC:

gcc -c -Wall t.c && echo ok
ok

g++ -c -Wall t.c
t.c: In function ‘void fn(int*)’:
t.c:4:36: warning: operation on ‘data’ may be undefined [-Wsequence-point]
   write (1, data++, sizeof (*data));
                                    ^


sizeof(*data)  does *not* dereference data.
>From gcc-bugs-return-422247-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 14 14:25:58 2013
Return-Path: <gcc-bugs-return-422247-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10418 invoked by alias); 14 May 2013 14:25:58 -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 10387 invoked by uid 48); 14 May 2013 14:25:54 -0000
From: "andrey.turetskiy at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/57275] New: Error in data dependence analysis during gather vectorization
Date: Tue, 14 May 2013 14:25:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: andrey.turetskiy 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc attachments.created
Message-ID: <bug-57275-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: 2013-05/txt/msg00920.txt.bz2
Content-length: 1565

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW275

            Bug ID: 57275
           Summary: Error in data dependence analysis during gather
                    vectorization
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrey.turetskiy at gmail dot com
                CC: kirill.yukhin at intel dot com

Created attachment 30110
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id0110&actioníit
Test showing the error

I've tried to compile this code for AVX2 with different optimization options:

 #include <stdio.h>
 #define N 1024

 float a[N], b[N], c[N];
 int k[N];

 __attribute__((noinline, noclone)) void
 f (void)
 {
   int i;
   for (i = 0; i < N; i++)
     {
       a[i] = b[k[i]];
       b[i] = c[i];
     }
 }

 int main ()
 {
   int i;

   for (i = 0; i < N; i++)
     {
       k[i] = i%2;
       b[i] = i;
       c[i] = 179;
     }

   f ();

   if (a[2] != 179 || a[3] != 179)
     printf("TEST FAILED\n\n");
   else
     printf("TEST PASSED\n\n");

   return 0;
 }

Results are different:

# ./gcc -mavx2 -O2 gather_test.c -o qqq.exe
# sde -- ./qqq.exe
TEST PASSED

# ./gcc -mavx2 -O3 gather_test.c -o www.exe
# sde -- ./www.exe
TEST FAILED

This bug have appeared because of error in data dependence analysis for
gathers. The loop in function f() has interleaving memory access, so it mustn't
be vectorized.
Before 4.9.0 it works correctly.


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

* [Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line
  2013-05-13 13:32 [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line thutt at vmware dot com
                   ` (7 preceding siblings ...)
  2013-05-14 14:01 ` ubizjak at gmail dot com
@ 2013-05-14 17:07 ` thutt at vmware dot com
  2013-05-14 18:00 ` ubizjak at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: thutt at vmware dot com @ 2013-05-14 17:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from thutt at vmware dot com ---
(In reply to Uroš Bizjak from comment #8)
> (In reply to thutt from comment #7)
> > (In reply to Uroš Bizjak from comment #6)
> > > (In reply to thutt from comment #5)
> > > > 
> > > > Does the same error exist in the 4.8 branch, or any other forward moving
> > > > branch?
> > > 
> > > No, 4.8 and newer branches already contain the original patch.
> > 
> > Sorry to be a bother, but can you tell me if the issue was / is in the 4.4
> > branch?
> 
> Yes, cld was removed in 4.3.0. Please see PR36079 that introduced -mcld.

When the sample test program provided above was compiled with gcc 4.4, it did
not generate the stos instruction.  However, each of 4.5, 4.6 and 4.7 did
generate the stos instruction.

Given this, I'd like to clarify your answer.  If I may summarize:

  4.3.0 stopped using cld.
  After cld was not used, an error existed in versions 4.4, 4.5, 4.6 and 4.7.
  The error was fixed in 4.8.
  You have backported the fix from 4.8 to 4.7.
  You did not backport to 4.5 and 4.6 because they are closed.
  You do not state, but I infer that 4.4 is also closed.

Do you have an idea why the test case does not demonstrate the error on 4.4?
Is there a test case that will demonstrate the error on 4.4?

Thanks for your help and patience
>From gcc-bugs-return-422271-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 14 17:12:07 2013
Return-Path: <gcc-bugs-return-422271-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 19969 invoked by alias); 14 May 2013 17:12:06 -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 19912 invoked by uid 55); 14 May 2013 17:12:01 -0000
From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/57267] [4.9 regression] -flto-partition=none : symbol is already defined
Date: Tue, 14 May 2013 17:12:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: lto
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hubicka at ucw dot cz
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57267-4-WhCfOLsEce@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57267-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57267-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: 2013-05/txt/msg00944.txt.bz2
Content-length: 192

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW267

--- Comment #2 from Jan Hubicka <hubicka at ucw dot cz> ---
This is fixed by
http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00695.html

Honza


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

* [Bug target/57264] cld not emitted when string instructions used, and '-mcld' on command line
  2013-05-13 13:32 [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line thutt at vmware dot com
                   ` (8 preceding siblings ...)
  2013-05-14 17:07 ` thutt at vmware dot com
@ 2013-05-14 18:00 ` ubizjak at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2013-05-14 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to thutt from comment #9)

> When the sample test program provided above was compiled with gcc 4.4, it
> did not generate the stos instruction.  However, each of 4.5, 4.6 and 4.7
> did generate the stos instruction.
> 
> Given this, I'd like to clarify your answer.  If I may summarize:
> 
>   4.3.0 stopped using cld.

Yes.

>   After cld was not used, an error existed in versions 4.4, 4.5, 4.6 and 4.7.

This was not an error, x86 ABI specifies that direction flag has to be cleared.
As a convenient feature, -mcld was introduced to "fix" non-conforming binaries
that played tricks with x86 direction flag.

>   The error was fixed in 4.8.

4.8 "fixed" this issue as a secondary effect of some other bugfix.

>   You have backported the fix from 4.8 to 4.7.

Yes.

>   You did not backport to 4.5 and 4.6 because they are closed.

Yes.

>   You do not state, but I infer that 4.4 is also closed.

Yes.

> Do you have an idea why the test case does not demonstrate the error on 4.4?
> Is there a test case that will demonstrate the error on 4.4?

As you have found out, the test is very fragile and depends on exact code
sequence of two consecutive instructions. This sequence is recognized in
combine pass as STOSL instruction. However, the dependence of STOSL on
direction flag is not modelled in the compiler, since it is not necessary for
ABI conformant binaries. In 4.4, the generated sequence is probably slightly
different, and for this reason not recognized as STOSL.
>From gcc-bugs-return-422275-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue May 14 18:07:39 2013
Return-Path: <gcc-bugs-return-422275-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4231 invoked by alias); 14 May 2013 18:07:38 -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 4175 invoked by uid 48); 14 May 2013 18:07:36 -0000
From: "andrey.turetskiy at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/57275] [4.9 Regression] Error in data dependence analysis during gather vectorization
Date: Tue, 14 May 2013 18:07:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: andrey.turetskiy at gmail dot com
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57275-4-L6Y4rSdPW5@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57275-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57275-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: 2013-05/txt/msg00948.txt.bz2
Content-length: 142

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW275

--- Comment #6 from Andrey Turetskiy <andrey.turetskiy at gmail dot com> ---
Oops, sorry.


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

end of thread, other threads:[~2013-05-14 18:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-13 13:32 [Bug c/57264] New: cld not emitted when string instructions used, and '-mcld' on command line thutt at vmware dot com
2013-05-13 15:41 ` [Bug target/57264] " ubizjak at gmail dot com
2013-05-13 15:56 ` ubizjak at gmail dot com
2013-05-13 17:26 ` ubizjak at gmail dot com
2013-05-13 17:28 ` ubizjak at gmail dot com
2013-05-13 17:56 ` thutt at vmware dot com
2013-05-13 18:54 ` ubizjak at gmail dot com
2013-05-14 13:41 ` thutt at vmware dot com
2013-05-14 14:01 ` ubizjak at gmail dot com
2013-05-14 17:07 ` thutt at vmware dot com
2013-05-14 18:00 ` ubizjak 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).