public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug pch/64117] warning control #pragmas in precompiled headers are not obeyed for template code
Date: Sun, 23 Aug 2015 15:33:00 -0000	[thread overview]
Message-ID: <bug-64117-4-Wu3jHNTm4U@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64117-4@http.gcc.gnu.org/bugzilla/>

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-08-23
                 CC|                            |manu at gcc dot gnu.org
          Component|c++                         |pch
     Ever confirmed|0                           |1

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
I can confirm this with GCC 6. I'm not sure if the pragmas are even saved in
the pch file. Someone would need to debug what is happening.
>From gcc-bugs-return-495453-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Aug 23 15:35:41 2015
Return-Path: <gcc-bugs-return-495453-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 98436 invoked by alias); 23 Aug 2015 15:35:41 -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 98394 invoked by uid 48); 23 Aug 2015 15:35:37 -0000
From: "trippels at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/67330] ICE handling weak attributes
Date: Sun, 23 Aug 2015 15:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: trippels at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
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_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-67330-4-PB8vY6qHa1@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67330-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67330-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-08/txt/msg01595.txt.bz2
Content-length: 2262

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-08-23
                 CC|                            |hubicka at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Doesn't happen with --enable-checking=release.

markus@x4 tmp % cat core.i
void fn1 (void)
{
  __attribute__ ((weak)) int a;
}
markus@x4 tmp % gcc -c core.i
core.i: In function ‘fn1’:
core.i:3:30: error: weak declaration of ‘a’ must be public
   __attribute__ ((weak)) int a;
                              ^

markus@x4 tmp % /var/tmp/gcc_test/usr/local/bin/gcc -c core.i
core.i: In function ‘fn1’:
core.i:3:3: internal compiler error: in get, at cgraph.h:371
   __attribute__ ((weak)) int a;
   ^
0x62f80c symtab_node::get(tree_node const*)
        ../../gcc/gcc/cgraph.h:368
0x62f80c handle_weak_attribute
        ../../gcc/gcc/c-family/c-common.c:8332
0x5a966a decl_attributes(tree_node**, tree_node*, int)
        ../../gcc/gcc/attribs.c:557
0x5c5674 start_decl(c_declarator*, c_declspecs*, bool, tree_node*)
        ../../gcc/gcc/c/c-decl.c:4547
0x6174e0 c_parser_declaration_or_fndef
        ../../gcc/gcc/c/c-parser.c:1830
0x61bb2d c_parser_compound_statement_nostart
        ../../gcc/gcc/c/c-parser.c:4622
0x61bf9e c_parser_compound_statement
        ../../gcc/gcc/c/c-parser.c:4533
0x617f88 c_parser_declaration_or_fndef
        ../../gcc/gcc/c/c-parser.c:1966
0x622107 c_parser_external_declaration
        ../../gcc/gcc/c/c-parser.c:1436
0x6229c9 c_parser_translation_unit
        ../../gcc/gcc/c/c-parser.c:1323
0x6229c9 c_parse_file()
        ../../gcc/gcc/c/c-parser.c:15449
0x67e642 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1058
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
>From gcc-bugs-return-495454-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Aug 23 16:27:53 2015
Return-Path: <gcc-bugs-return-495454-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 47603 invoked by alias); 23 Aug 2015 16:27:52 -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 47535 invoked by uid 48); 23 Aug 2015 16:27:47 -0000
From: "sasha.levin at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/67330] ICE handling weak attributes
Date: Sun, 23 Aug 2015 16:27:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords: ice-on-invalid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: sasha.levin at oracle dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
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-67330-4-q8evxziqqb@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67330-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67330-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-08/txt/msg01596.txt.bz2
Content-length: 10707

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

--- Comment #3 from Sasha Levin <sasha.levin at oracle dot com> ---
This is the -v invocation:

Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/sasha/gcc-inst/ --with-arch=native
--with-tune=native --enable-languages=c --enable-lto --enable-gold
--enable-stage1-languages=c
Thread model: posix
gcc version 6.0.0 20150823 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-nostdinc' '-isystem'
'/home/sasha/gcc-inst/lib/gcc/x86_64-pc-linux-gnu/6.0.0/include' '-I'
'./arch/x86/include' '-I' 'arch/x86/include/generated/uapi' '-I'
'arch/x86/include/generated' '-I' 'include' '-I' './arch/x86/include/uapi' '-I'
'arch/x86/include/generated/uapi' '-I' './include/uapi' '-I'
'include/generated/uapi' '-include' './include/linux/kconfig.h' '-D'
'__KERNEL__' '-Wall' '-Wundef' '-Wstrict-prototypes' '-Wno-trigraphs'
'-fno-strict-aliasing' '-fno-common' '-Werror=implicit-function-declaration'
'-Wno-format-security' '-std=gnu90' '-mno-sse' '-mno-mmx' '-mno-sse2'
'-mno-3dnow' '-mno-avx' '-m64' '-falign-jumps=1' '-falign-loops=1' '-mno-80387'
'-mno-fp-ret-in-387' '-mpreferred-stack-boundary=3' '-mskip-rax-setup'
'-march=native' '-mno-red-zone' '-mcmodel=kernel' '-funit-at-a-time'
'-maccumulate-outgoing-args' '-D' 'CONFIG_X86_X32_ABI' '-D'
'CONFIG_AS_FXSAVEQ=1' '-D' 'CONFIG_AS_SSSE3=1' '-D' 'CONFIG_AS_CRC32=1' '-D'
'CONFIG_AS_AVX=1' '-D' 'CONFIG_AS_AVX2=1' '-pipe' '-Wno-sign-compare'
'-fno-asynchronous-unwind-tables' '-fno-delete-null-pointer-checks' '-O2'
'--param' 'allow-store-data-races=0' '-fno-reorder-blocks' '-fno-ipa-cp-clone'
'-fno-partial-inlining' '-Wframe-larger-than=2048' '-fstack-protector'
'-Wno-unused-but-set-variable' '-fno-omit-frame-pointer'
'-fno-optimize-sibling-calls' '-fno-var-tracking-assignments' '-g' '-gdwarf-4'
'-pg' '-mfentry' '-D' 'CC_USING_FENTRY' '-fno-inline-functions-called-once'
'-Wdeclaration-after-statement' '-Wno-pointer-sign' '-fno-strict-overflow'
'-fconserve-stack' '-Werror=implicit-int' '-Werror=strict-prototypes'
'-Werror=date-time' '-D' 'CC_HAVE_ASM_GOTO' '-fsanitize=kernel-address'
'-fasan-shadow-offset=0xdffffc0000000000' '--param' 'asan-stack=1' '--param'
'asan-globals=1' '--param' 'asan-instrumentation-with-call-threshold=10000'
'-D' 'KBUILD_STR(s)=#s' '-D' 'KBUILD_BASENAME=KBUILD_STR(core)' '-D'
'KBUILD_MODNAME=KBUILD_STR(core)' '-c' '-o' 'kernel/sched/.tmp_core.o'
 /home/sasha/gcc-inst/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/cc1 -quiet
-nostdinc -v -I ./arch/x86/include -I arch/x86/include/generated/uapi -I
arch/x86/include/generated -I include -I ./arch/x86/include/uapi -I
arch/x86/include/generated/uapi -I ./include/uapi -I include/generated/uapi
-imultiarch x86_64-linux-gnu -D __KERNEL__ -D CONFIG_X86_X32_ABI -D
CONFIG_AS_FXSAVEQ=1 -D CONFIG_AS_SSSE3=1 -D CONFIG_AS_CRC32=1 -D
CONFIG_AS_AVX=1 -D CONFIG_AS_AVX2=1 -D CC_USING_FENTRY -D CC_HAVE_ASM_GOTO -D
KBUILD_STR(s)=#s -D KBUILD_BASENAME=KBUILD_STR(core) -D
KBUILD_MODNAME=KBUILD_STR(core) -isystem
/home/sasha/gcc-inst/lib/gcc/x86_64-pc-linux-gnu/6.0.0/include -include
./include/linux/kconfig.h -MD kernel/sched/.core.o.d kernel/sched/core.c
-march=nehalem -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16
-msahf -mno-movbe -mno-aes -mno-sha -mno-pclmul -mpopcnt -mno-abm -mno-lwp
-mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2
-msse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c
-mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt
-mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1
-mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw
-mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit
-mno-mwaitx --param l1-cache-size=32 --param l1-cache-line-size=64 --param
l2-cache-size=24576 -mtune=nehalem -quiet -dumpbase core.c -mno-sse -mno-mmx
-mno-sse2 -mno-3dnow -mno-avx -m64 -mno-80387 -mno-fp-ret-in-387
-mpreferred-stack-boundary=3 -mskip-rax-setup -mno-red-zone -mcmodel=kernel
-maccumulate-outgoing-args -mfentry -auxbase-strip kernel/sched/.tmp_core.o -g
-gdwarf-4 -O2 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
-Werror=implicit-function-declaration -Wno-format-security -Wno-sign-compare
-Wframe-larger-than=2048 -Wno-unused-but-set-variable
-Wdeclaration-after-statement -Wno-pointer-sign -Werror=implicit-int
-Werror=strict-prototypes -Werror=date-time -std=gnu90 -version -p
-fno-strict-aliasing -fno-common -falign-jumps=1 -falign-loops=1
-funit-at-a-time -fno-asynchronous-unwind-tables
-fno-delete-null-pointer-checks -fno-reorder-blocks -fno-ipa-cp-clone
-fno-partial-inlining -fstack-protector -fno-omit-frame-pointer
-fno-optimize-sibling-calls -fno-var-tracking-assignments
-fno-inline-functions-called-once -fno-strict-overflow -fconserve-stack
-fsanitize=kernel-address -fasan-shadow-offset=0xdffffc0000000000 --param
allow-store-data-races=0 --param asan-stack=1 --param asan-globals=1 --param
asan-instrumentation-with-call-threshold=10000 -o - |
 as -v -I ./arch/x86/include -I arch/x86/include/generated/uapi -I
arch/x86/include/generated -I include -I ./arch/x86/include/uapi -I
arch/x86/include/generated/uapi -I ./include/uapi -I include/generated/uapi
--64 -o kernel/sched/.tmp_core.o
GNU C89 (GCC) version 6.0.0 20150823 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 6.0.0 20150823 (experimental), GMP version
5.0.5, MPFR version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring duplicate directory "arch/x86/include/generated/uapi"
#include "..." search starts here:
#include <...> search starts here:
 ./arch/x86/include
 arch/x86/include/generated/uapi
 arch/x86/include/generated
 include
 ./arch/x86/include/uapi
 ./include/uapi
 include/generated/uapi
 /home/sasha/gcc-inst/lib/gcc/x86_64-pc-linux-gnu/6.0.0/include
End of search list.
GNU C89 (GCC) version 6.0.0 20150823 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 6.0.0 20150823 (experimental), GMP version
5.0.5, MPFR version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU assembler version 2.24 (x86_64-linux-gnu) using BFD version (GNU Binutils
for Debian) 2.24
Compiler executable checksum: 5d34ea2cdcf90b3d08395d2e098e1d89
kernel/sched/core.c: In function ‘__schedule’:
kernel/sched/core.c:3049:7: warning: unused variable ‘doit’ [-Wunused-variable]
  bool doit = false;
       ^
In file included from include/linux/perf_event.h:47:0,
                 from kernel/sched/core.c:41:
kernel/sched/core.c: In function ‘get_parent_ip’:
include/linux/ftrace.h:671:36: warning: calling ‘__builtin_return_address’ with
a nonzero argument is unsafe [-Wframe-address]
 #  define ftrace_return_address(n) __builtin_return_address(n)
                                    ^
include/linux/ftrace.h:679:38: note: in expansion of macro
‘ftrace_return_address’
 #define CALLER_ADDR2 ((unsigned long)ftrace_return_address(2))
                                      ^
kernel/sched/core.c:2854:10: note: in expansion of macro ‘CALLER_ADDR2’
   addr = CALLER_ADDR2;
          ^
include/linux/ftrace.h:671:36: warning: calling ‘__builtin_return_address’ with
a nonzero argument is unsafe [-Wframe-address]
 #  define ftrace_return_address(n) __builtin_return_address(n)
                                    ^
include/linux/ftrace.h:680:38: note: in expansion of macro
‘ftrace_return_address’
 #define CALLER_ADDR3 ((unsigned long)ftrace_return_address(3))
                                      ^
kernel/sched/core.c:2856:11: note: in expansion of macro ‘CALLER_ADDR3’
    addr = CALLER_ADDR3;
           ^
COMPILER_PATH=/home/sasha/gcc-inst/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/:/home/sasha/gcc-inst/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/:/home/sasha/gcc-inst/libexec/gcc/x86_64-pc-linux-gnu/:/home/sasha/gcc-inst/lib/gcc/x86_64-pc-linux-gnu/6.0.0/:/home/sasha/gcc-inst/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/home/sasha/gcc-inst/lib/gcc/x86_64-pc-linux-gnu/6.0.0/:/home/sasha/gcc-inst/lib/gcc/x86_64-pc-linux-gnu/6.0.0/../../../../lib64/:/lib/x86_64-linux-gnu/:/lib/../lib64/:/usr/lib/x86_64-linux-gnu/:/home/sasha/gcc-inst/lib/gcc/x86_64-pc-linux-gnu/6.0.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-nostdinc' '-isystem'
'/home/sasha/gcc-inst/lib/gcc/x86_64-pc-linux-gnu/6.0.0/include' '-I'
'./arch/x86/include' '-I' 'arch/x86/include/generated/uapi' '-I'
'arch/x86/include/generated' '-I' 'include' '-I' './arch/x86/include/uapi' '-I'
'arch/x86/include/generated/uapi' '-I' './include/uapi' '-I'
'include/generated/uapi' '-include' './include/linux/kconfig.h' '-D'
'__KERNEL__' '-Wall' '-Wundef' '-Wstrict-prototypes' '-Wno-trigraphs'
'-fno-strict-aliasing' '-fno-common' '-Werror=implicit-function-declaration'
'-Wno-format-security' '-std=gnu90' '-mno-sse' '-mno-mmx' '-mno-sse2'
'-mno-3dnow' '-mno-avx' '-m64' '-falign-jumps=1' '-falign-loops=1' '-mno-80387'
'-mno-fp-ret-in-387' '-mpreferred-stack-boundary=3' '-mskip-rax-setup'
'-march=native' '-mno-red-zone' '-mcmodel=kernel' '-funit-at-a-time'
'-maccumulate-outgoing-args' '-D' 'CONFIG_X86_X32_ABI' '-D'
'CONFIG_AS_FXSAVEQ=1' '-D' 'CONFIG_AS_SSSE3=1' '-D' 'CONFIG_AS_CRC32=1' '-D'
'CONFIG_AS_AVX=1' '-D' 'CONFIG_AS_AVX2=1' '-pipe' '-Wno-sign-compare'
'-fno-asynchronous-unwind-tables' '-fno-delete-null-pointer-checks' '-O2'
'--param' 'allow-store-data-races=0' '-fno-reorder-blocks' '-fno-ipa-cp-clone'
'-fno-partial-inlining' '-Wframe-larger-than=2048' '-fstack-protector'
'-Wno-unused-but-set-variable' '-fno-omit-frame-pointer'
'-fno-optimize-sibling-calls' '-fno-var-tracking-assignments' '-g' '-gdwarf-4'
'-pg' '-mfentry' '-D' 'CC_USING_FENTRY' '-fno-inline-functions-called-once'
'-Wdeclaration-after-statement' '-Wno-pointer-sign' '-fno-strict-overflow'
'-fconserve-stack' '-Werror=implicit-int' '-Werror=strict-prototypes'
'-Werror=date-time' '-D' 'CC_HAVE_ASM_GOTO' '-fsanitize=kernel-address'
'-fasan-shadow-offset=0xdffffc0000000000' '--param' 'asan-stack=1' '--param'
'asan-globals=1' '--param' 'asan-instrumentation-with-call-threshold=10000'
'-D' 'KBUILD_STR(s)=#s' '-D' 'KBUILD_BASENAME=KBUILD_STR(core)' '-D'
'KBUILD_MODNAME=KBUILD_STR(core)' '-c' '-o' 'kernel/sched/.tmp_core.o'
>From gcc-bugs-return-495455-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Aug 23 16:29:13 2015
Return-Path: <gcc-bugs-return-495455-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 49342 invoked by alias); 23 Aug 2015 16:29:13 -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 49289 invoked by uid 48); 23 Aug 2015 16:29:10 -0000
From: "wschmidt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/37021] Fortran Complex reduction / multiplication not vectorized
Date: Sun, 23 Aug 2015 16:29: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.4.0
X-Bugzilla-Keywords: alias, missed-optimization
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: wschmidt at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-37021-4-oFolLZ8pjJ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-37021-4@http.gcc.gnu.org/bugzilla/>
References: <bug-37021-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-08/txt/msg01597.txt.bz2
Content-length: 2691

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

Bill Schmidt <wschmidt at gcc dot gnu.org> changed:

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

--- Comment #20 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
We still don't vectorize the original code example on Power.  It appears that
this is being disabled because of an alignment issue.  The data references are
being rejected by:

product.f:9:0: note: can't force alignment of ref: REALPART_EXPR <*a.0_24[_50]>

and similar for the other three DRs.  This happens due to this code in
vect_compute_data_ref_alignment:

  if (base_alignment < TYPE_ALIGN (vectype))
    {
      /* Strip an inner MEM_REF to a bare decl if possible.  */
      if (TREE_CODE (base) == MEM_REF
          && integer_zerop (TREE_OPERAND (base, 1))
          && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR)
        base = TREE_OPERAND (TREE_OPERAND (base, 0), 0);

      if (!vect_can_force_dr_alignment_p (base, TYPE_ALIGN (vectype)))
        {
          if (dump_enabled_p ())
            {
              dump_printf_loc (MSG_NOTE, vect_location,
                               "can't force alignment of ref: ");
              dump_generic_expr (MSG_NOTE, TDF_SLIM, ref);
              dump_printf (MSG_NOTE, "\n");
            }
          return true;
        }

Here TYPE_ALIGN (vectype) is 128 (Power vectors are normally aligned on a
128-bit value), and base_alignment is 64.  a.0 is defined as:

complex(kind=8) [0:D.1831] * restrict a.0;

In both ELFv1 and ELFv2 ABIs for Power, a complex type is defined to have the
same alignment as the underlying type.  So "complex double" has 8-byte
alignment.

On earlier versions of Power, the decision is fine, because unaligned accesses
are expensive prior to POWER8.  With POWER8, though, an unaligned access will
(most of the time) perform as well as an aligned access.  So ideally we would
like to teach the vectorizer to allow vectorization here.

It seems like vect_supportable_dr_alignment ought to be considered as part of
the SLP vectorization decision here, rather than just comparing the base
alignment with the vector type alignment.  Adding a check for that allows
things to get a little further, but we still don't vectorize the block.  (I
haven't yet looked into why, but I assume more needs to be done downstream to
handle this case.)

My understanding of the vectorizer is not yet very deep, so before going too
far down the wrong path, I'd like your opinion on the best approach to fixing
the problem.  Thanks!

Bill


  parent reply	other threads:[~2015-08-23 15:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29 15:52 [Bug c++/64117] New: " gcc-oren@ben-kiki.org
2014-12-19 13:11 ` [Bug c++/64117] " gcc-oren@ben-kiki.org
2015-08-23 14:16 ` gcc-oren@ben-kiki.org
2015-08-23 15:33 ` manu at gcc dot gnu.org [this message]
2020-06-24 12:30 ` [Bug pch/64117] " fsmoke at mail dot ru
2021-02-25 11:32 ` chihchengyuan at gmail dot com
2021-06-14 19:02 ` colomar.6.4.3 at gmail dot com
2021-06-14 19:04 ` colomar.6.4.3 at gmail dot com
2023-11-08  3:24 ` lhyatt at gcc dot gnu.org
2023-11-28 17:12 ` lhyatt at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-64117-4-Wu3jHNTm4U@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).