public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/62249] New: Spurious FORTIFY_SOURCE warning with -flto, poll
@ 2014-08-24 15:51 zackw at panix dot com
  2014-08-24 16:43 ` [Bug lto/62249] " zackw at panix dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zackw at panix dot com @ 2014-08-24 15:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62249
           Summary: Spurious FORTIFY_SOURCE warning with -flto, poll
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zackw at panix dot com

Created attachment 33388
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33388&action=edit
test case (compile on recent glibc system)

Compile the attached program on a recent-glibc system with -D_FORTIFY_SOURCE=2
-O2 -flto and you get a spurious warning:

$ gcc -flto -O2 -D_FORTIFY_SOURCE=2 test.c
In function ‘__poll_alias’,
    inlined from ‘main’ at test.c:17:9:
/usr/include/x86_64-linux-gnu/bits/poll2.h:41:2: warning: call to
‘__poll_chk_warn’ declared with attribute warning: poll called with fds buffer
too small file nfds entries
  return __poll_chk (__fds, __nfds, __timeout, __bos (__fds));

$ gcc -fwhole-program -O2 -D_FORTIFY_SOURCE=2 test.c
$

Inspection of bits/poll2.h leads me to believe that the glibc folks expect this
construct ...

__fortify_function int
poll (struct pollfd *__fds, nfds_t __nfds, int __timeout)
{
  if (__bos (__fds) != (__SIZE_TYPE__) -1)
    {
      if (! __builtin_constant_p (__nfds))
        return __poll_chk (__fds, __nfds, __timeout, __bos (__fds));
      else if (__bos (__fds) / sizeof (*__fds) < __nfds)
        return __poll_chk_warn (__fds, __nfds, __timeout, __bos (__fds));
    }

  return __poll_alias (__fds, __nfds, __timeout);
}

... to have the dead arm of the inner 'if' eliminated (one of them must be
dead, because the condition is a call to __builtin_constant_p) before warnings
are issued.
>From gcc-bugs-return-459158-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Aug 24 15:53:25 2014
Return-Path: <gcc-bugs-return-459158-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11571 invoked by alias); 24 Aug 2014 15:53:24 -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 11531 invoked by uid 48); 24 Aug 2014 15:53:20 -0000
From: "danglin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/62250] New: FAIL: gfortran.dg/coarray/alloc_comp_1.f90 -fcoarray=lib  -O2  -lcaf_single
Date: Sun, 24 Aug 2014 15:53:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libfortran
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: danglin at gcc dot gnu.org
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 cf_gcchost cf_gcctarget cf_gccbuild
Message-ID: <bug-62250-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-08/txt/msg01655.txt.bz2
Content-length: 5178

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

            Bug ID: 62250
           Summary: FAIL: gfortran.dg/coarray/alloc_comp_1.f90
                    -fcoarray=lib  -O2  -lcaf_single
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
              Host: hppa2.0w-hp-hpux11.11
            Target: hppa2.0w-hp-hpux11.11
             Build: hppa2.0w-hp-hpux11.11

Executing on host: /test/gnu/gcc/objdir/gcc/testsuite/gfortran/../../gfortran
-B
/test/gnu/gcc/objdir/gcc/testsuite/gfortran/../../
-B/test/gnu/gcc/objdir/hppa2.
0w-hp-hpux11.11/./libgfortran/
/test/gnu/gcc/gcc/gcc/testsuite/gfortran.dg/coarr
ay/alloc_comp_1.f90  -fno-diagnostics-show-caret -fdiagnostics-color=never
-fcoarray=lib  -O2  -lcaf_single
-B/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./li
bgfortran/.libs
-L/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgfortran/.libs
-L/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgfortran/.libs -B/test/gnu/gc
c/objdir/hppa2.0w-hp-hpux11.11/./libquadmath/.libs
-L/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libquadmath/.libs
-L/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11
/./libquadmath/.libs  -lm    -o ./alloc_comp_1.exe    (timeout = 300)spawn
/test/gnu/gcc/objdir/gcc/testsuite/gfortran/../../gfortran -B/test/gnu/gcc
/objdir/gcc/testsuite/gfortran/../../
-B/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgfortran/
/test/gnu/gcc/gcc/gcc/testsuite/gfortran.dg/coarray/alloc_comp
_1.f90 -fno-diagnostics-show-caret -fdiagnostics-color=never -fcoarray=lib -O2
-
lcaf_single -B/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgfortran/.libs
-L/
test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgfortran/.libs
-L/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgfortran/.libs
-B/test/gnu/gcc/objdir/hppa2.0w-h
p-hpux11.11/./libquadmath/.libs
-L/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./l
ibquadmath/.libs
-L/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libquadmath/.lib
s -lm -o ./alloc_comp_1.exe
/usr/ccs/bin/ld: Unsatisfied symbols:
   __atomic_fetch_and_4 (first referenced in
/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgfortran/.libs/libcaf_single.a(single.o))
(code)
   __atomic_compare_exchange_4 (first referenced in
/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgfortran/.libs/libcaf_single.a(single.o))
(code)
   __atomic_fetch_xor_4 (first referenced in
/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgfortran/.libs/libcaf_single.a(single.o))
(code)
   __atomic_fetch_add_4 (first referenced in
/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgfortran/.libs/libcaf_single.a(single.o))
(code)
   __atomic_fetch_or_4 (first referenced in
/test/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/./libgfortran/.libs/libcaf_single.a(single.o))
(code)
collect2: error: ld returned 1 exit status

Similar fails:
FAIL: gfortran.dg/coarray/allocate_errgmsg.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/atomic_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/atomic_2.f90 -fcoarray=single  -O2
FAIL: gfortran.dg/coarray/atomic_2.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/codimension.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/coindexed_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/coindexed_3.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/collectives_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/collectives_2.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/dummy_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/get_array.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/image_index_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/image_index_2.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/image_index_3.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/lib_realloc_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/lock_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/move_alloc_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/poly_run_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/poly_run_2.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/poly_run_3.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/registering_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/scalar_alloc_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/scalar_alloc_2.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/send_array.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/sendget_array.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/subobject_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/sync_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/sync_3.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/this_image_1.f90 -fcoarray=lib  -O2  -lcaf_single
FAIL: gfortran.dg/coarray/this_image_2.f90 -fcoarray=lib  -O2  -lcaf_single


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

* [Bug lto/62249] Spurious FORTIFY_SOURCE warning with -flto, poll
  2014-08-24 15:51 [Bug lto/62249] New: Spurious FORTIFY_SOURCE warning with -flto, poll zackw at panix dot com
@ 2014-08-24 16:43 ` zackw at panix dot com
  2014-08-24 16:45 ` zackw at panix dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zackw at panix dot com @ 2014-08-24 16:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Zack Weinberg <zackw at panix dot com> ---
Created attachment 33389
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33389&action=edit
Delta-minimized self-contained test case

Requires no headers anymore.

Delta-minimization revealed something interesting:

int __poll_chk (struct pollfd *, unsigned, int, unsigned);
int __poll_chk_warn (struct pollfd *, unsigned, int, unsigned)
  __asm__ ("__poll_chk")
  __attribute__ ((__warning__ ("poll called with fds buffer too small")));

The __asm__("__poll_chk") annotation is essential; if it's removed the bug goes
away.  I don't know anything about the guts of LTO, but to me that suggests a
bug in its unification of function decls, rather than a bug in dead-code
removal.


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

* [Bug lto/62249] Spurious FORTIFY_SOURCE warning with -flto, poll
  2014-08-24 15:51 [Bug lto/62249] New: Spurious FORTIFY_SOURCE warning with -flto, poll zackw at panix dot com
  2014-08-24 16:43 ` [Bug lto/62249] " zackw at panix dot com
@ 2014-08-24 16:45 ` zackw at panix dot com
  2014-10-10 12:51 ` i.palachev at samsung dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zackw at panix dot com @ 2014-08-24 16:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Zack Weinberg <zackw at panix dot com> ---
Incidentally, yes, the test case is based on a real program.


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

* [Bug lto/62249] Spurious FORTIFY_SOURCE warning with -flto, poll
  2014-08-24 15:51 [Bug lto/62249] New: Spurious FORTIFY_SOURCE warning with -flto, poll zackw at panix dot com
  2014-08-24 16:43 ` [Bug lto/62249] " zackw at panix dot com
  2014-08-24 16:45 ` zackw at panix dot com
@ 2014-10-10 12:51 ` i.palachev at samsung dot com
  2014-10-10 13:07 ` zackw at panix dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: i.palachev at samsung dot com @ 2014-10-10 12:51 UTC (permalink / raw)
  To: gcc-bugs

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

Ilya Palachev <i.palachev at samsung dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |i.palachev at samsung dot com

--- Comment #3 from Ilya Palachev <i.palachev at samsung dot com> ---
The bug reproduces for me even without -D_FORTIFY_SOURCE=2.


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

* [Bug lto/62249] Spurious FORTIFY_SOURCE warning with -flto, poll
  2014-08-24 15:51 [Bug lto/62249] New: Spurious FORTIFY_SOURCE warning with -flto, poll zackw at panix dot com
                   ` (2 preceding siblings ...)
  2014-10-10 12:51 ` i.palachev at samsung dot com
@ 2014-10-10 13:07 ` zackw at panix dot com
  2015-01-16 22:01 ` crrodriguez at opensuse dot org
  2015-02-11  8:29 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: zackw at panix dot com @ 2014-10-10 13:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Zack Weinberg <zackw at panix dot com> ---
The "delta-minimized self-contained test case" should require only `-O2 -flto`
to reproduce the problem.  The other test case, however, should require
`-D_FORTIFY_SOURCE=2` in addition, and to be compiled against recent glibc.

Note also that this does not happen with 4.8 or older.


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

* [Bug lto/62249] Spurious FORTIFY_SOURCE warning with -flto, poll
  2014-08-24 15:51 [Bug lto/62249] New: Spurious FORTIFY_SOURCE warning with -flto, poll zackw at panix dot com
                   ` (3 preceding siblings ...)
  2014-10-10 13:07 ` zackw at panix dot com
@ 2015-01-16 22:01 ` crrodriguez at opensuse dot org
  2015-02-11  8:29 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: crrodriguez at opensuse dot org @ 2015-01-16 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

Cristian Rodríguez <crrodriguez at opensuse dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crrodriguez at opensuse dot org

--- Comment #5 from Cristian Rodríguez <crrodriguez at opensuse dot org> ---
This bug also affects building systemd with LTO enabled.
>From gcc-bugs-return-473610-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jan 16 22:13:43 2015
Return-Path: <gcc-bugs-return-473610-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2637 invoked by alias); 16 Jan 2015 22:13:42 -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 2607 invoked by uid 48); 16 Jan 2015 22:13:37 -0000
From: "chengniansun at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/64637] New: Incorrect location for -Wunused-value warnings in for-loop
Date: Fri, 16 Jan 2015 22:13: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: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: chengniansun 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
Message-ID: <bug-64637-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: 2015-01/txt/msg01604.txt.bz2
Content-length: 1071

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

            Bug ID: 64637
           Summary: Incorrect location for -Wunused-value warnings in
                    for-loop
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

GCC emits a warning at the start of the for statement, whereas the unused value
is in the next line. This behavior could introduce confusion that the "for"
statement has no effect, which is not true. 



$: cat s.c
void g();

void f(int b) {
  for(int i = 0; i < b; 
      i + b) {
    g();
  }
}
$: 
$: gcc-trunk -Wunused-value -c s.c
s.c: In function ‘f’:
s.c:4:3: warning: statement with no effect [-Wunused-value]
   for(int i = 0; i < b; 
   ^
$: 
$: clang-trunk -Wunused-value -c s.c
s.c:5:9: warning: expression result unused [-Wunused-value]
      i + b) {
      ~ ^ ~
1 warning generated.
$: 
$:
>From gcc-bugs-return-473611-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jan 16 22:24:40 2015
Return-Path: <gcc-bugs-return-473611-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8595 invoked by alias); 16 Jan 2015 22:24:39 -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 8546 invoked by uid 48); 16 Jan 2015 22:24:33 -0000
From: "vmakarov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/64477] [4.9/5 Regression] x86 sse unnecessary GPR spill
Date: Fri, 16 Jan 2015 22:24:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords: missed-optimization, ra
X-Bugzilla-Severity: normal
X-Bugzilla-Who: vmakarov at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.3
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64477-4-JwXqnA6nTK@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64477-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64477-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: 2015-01/txt/msg01605.txt.bz2
Content-length: 2466

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

--- Comment #4 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
It is hard for me to consider the PR RA fault.  The pseudo 90 gets memory as
its cost 3000 for DIREG (4000 for any general reg) and 2000 for memory.

    2: r90:SI=di:SI
      REG_DEAD di:SI
    8: r95:V4SI=vec_merge(vec_duplicate(r90:SI),const_vector,0x1)

Cost 4000 for GENERAL_REGS is a result of description of insn 8:

(define_insn "vec_set<mode>_0"
  [(set (match_operand:VI4F_128 0 "nonimmediate_operand"
          "=Yr,*v,v,v ,x,x,v,Yr ,*x ,x  ,m ,m   ,m")
        (vec_merge:VI4F_128
          (vec_duplicate:VI4F_128
            (match_operand:<ssescalarmode> 2 "general_operand"
          " Yr,*v,m,*r,m,x,v,*rm,*rm,*rm,!x,!*re,!*fF"))
          (match_operand:VI4F_128 1 "vector_move_operand"
          " C , C,C,C ,C,0,v,0  ,0  ,x  ,0 ,0   ,0")
          (const_int 1)))]
  "TARGET_SSE"
  "@
   %vinsertps\t{$0xe, %d2, %0|%0, %d2, 0xe}
   %vinsertps\t{$0xe, %d2, %0|%0, %d2, 0xe}
   %vmov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
   %vmovd\t{%2, %0|%0, %2}
   movss\t{%2, %0|%0, %2}
   movss\t{%2, %0|%0, %2}
   vmovss\t{%2, %1, %0|%0, %1, %2}
   pinsrd\t{$0, %2, %0|%0, %2, 0}
   pinsrd\t{$0, %2, %0|%0, %2, 0}
   vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0}
   #
   #
   #"

The description uses too many * which excludes r (in operand 2 of alt#3) from
consideration for choosing pseudo class.  The corresponding insn movd is
perfectly fine.  I believe * should be used in rare cases.  If you want to
disfavor alternative, e.g. because the corresponding insn is costly or it needs
more one insn (that is usually a split case), it is better to use '?' for this.
 It is better not to exclude constraints (reg classes), let RA chooses the
class itself based on costs.  Without the change, RA calculates the cost of
GENERAL_REGS for pseudo 90 (2nd operand) by moving it through memory.

So the following change solves the problem (* before 'r' is removed from 3rd
alt).

" Yr,*v,m,r,m,x,v,*rm,*rm,*rm,!x,!*re,!*fF"

I'd also change * before 'v' onto '?' because we could choose v (all SSE regs)
instead of Yr (SSE regs without usage an additional prefix in the insn) and
still disparage them as v results in longer insn.

The only problem is that I guess there are a lot of such insn definitions and
analogous problem might be in future.

The first change was bootstrapped successfully with --with-cpu=core-avx2 and
--with-arch=core-avx2.


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

* [Bug lto/62249] Spurious FORTIFY_SOURCE warning with -flto, poll
  2014-08-24 15:51 [Bug lto/62249] New: Spurious FORTIFY_SOURCE warning with -flto, poll zackw at panix dot com
                   ` (4 preceding siblings ...)
  2015-01-16 22:01 ` crrodriguez at opensuse dot org
@ 2015-02-11  8:29 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-02-11  8:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Duplicate.

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


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

end of thread, other threads:[~2015-02-11  8:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-24 15:51 [Bug lto/62249] New: Spurious FORTIFY_SOURCE warning with -flto, poll zackw at panix dot com
2014-08-24 16:43 ` [Bug lto/62249] " zackw at panix dot com
2014-08-24 16:45 ` zackw at panix dot com
2014-10-10 12:51 ` i.palachev at samsung dot com
2014-10-10 13:07 ` zackw at panix dot com
2015-01-16 22:01 ` crrodriguez at opensuse dot org
2015-02-11  8:29 ` 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).