[Bug c/79025] Incorrect loop optimization for -Os and above

2017-01-08 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79025

Eric Botcazou  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||ebotcazou at gcc dot gnu.org
 Resolution|--- |INVALID

--- Comment #3 from Eric Botcazou  ---
As Andrew said, the code has undefined behavior at run time as per ISO C so any
output is acceptable.  Compile it with -fwrapv to work around the problem.

[Bug middle-end/77484] [6/7 Regression] Static branch predictor causes ~6-8% regression of SPEC2000 GAP

2017-01-08 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77484

--- Comment #24 from Jan Hubicka  ---
Author: hubicka
Date: Sun Jan  8 09:53:06 2017
New Revision: 244207

URL: https://gcc.gnu.org/viewcvs?rev=244207&root=gcc&view=rev
Log:
PR middle-end/77484
* predict.def (PRED_INDIR_CALL): Set to 86.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/predict.def

[Bug c++/79021] attribute noreturn on function template ignored in generic lambda

2017-01-08 Thread akim.demaille at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79021

--- Comment #1 from Akim Demaille  ---
Also observed with GCC 7.

$ g++-mp-7 -std=c++14 foo.cc -Wreturn-type
foo.cc: In lambda function:
foo.cc:21:38: warning: no return statement in function returning non-void
[-Wreturn-type]
   auto g = [](auto a) -> int { f(a); };
  ^
$ g++-mp-7 --version
g++-mp-7 (MacPorts gcc7 7-20170101_0) 7.0.0 20170101 (experimental)
Copyright (C) 2017 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.

[Bug c++/79024] alignas / alignof report wrong alignment for 64bit integer types for 32bit target

2017-01-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79024

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from Jonathan Wakely  ---
(In reply to Xidorn Quan from comment #2)
> ABI requires a different alignment than in struct?

Yes.

> That's interesting. But I
> think developers (I mean, users of compilers) are generally more interested
> on alignment requirement in struct rather than that for ABI, and most
> description of the concept "alignment" refers to that in struct, so it is
> probably better make alignof / alignas report that value.

It's arguable whether that would be standard conforming. alignas(T) tells you
the alignment needed for an obejct of type T. If you want the alignment for a
subobject of type T that's a different question, and you can get it by doing:

struct S { T t; };
alignas(S)

Or more generally:

template
  struct alignof_subobject
  {
struct S { T t; };
static constexpr std::size_t value = alignof(S);
  };

struct Test2 { char c; alignas(alignof_subobject::value) uint64_t u;
};

[Bug c++/79024] alignas / alignof report wrong alignment for 64bit integer types for 32bit target

2017-01-08 Thread gnu-9fbaow at upsuper dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79024

--- Comment #4 from Xidorn Quan  ---
(In reply to Jonathan Wakely from comment #3)
> (In reply to Xidorn Quan from comment #2)
> > That's interesting. But I
> > think developers (I mean, users of compilers) are generally more interested
> > on alignment requirement in struct rather than that for ABI, and most
> > description of the concept "alignment" refers to that in struct, so it is
> > probably better make alignof / alignas report that value.
> 
> It's arguable whether that would be standard conforming. alignas(T) tells
> you the alignment needed for an obejct of type T.

The standard says "Object types have alignment requirements (3.9.1, 3.9.2)
which place restrictions on the addresses at which an object of that type may
be allocated." (3.11.1)

I think it indicates that the alignment requirement is something that an object
of type must always be aligned to, which, in case of 64bit integers on 32bit
platform, should be 4 bytes instead of 8 bytes, since you do place them on
non-8byte aligned addresses.

> If you want the alignment
> for a subobject of type T that's a different question, and you can get it by
> doing:
> 
> struct S { T t; };
> alignas(S)

This is not always doable. Sometimes you may want to get alignment of an
abstract class, which you cannot put in a struct. And in Mozilla's codebase, I
do see this kind of usages. (We currently have a macro for doing alignment
query which uses similiar technique, and when I tried to use that macro in our
internal aligned_storage equivalent, it fails to compile due to those usages.)

It is doable, though, via using a more complicated helper template to handle
primitives and classes separately. But I still think this is something should
be fixed.

[Bug rtl-optimization/79003] [7 Regression] r238991 breaks ODR

2017-01-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79003

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Sun Jan  8 16:43:30 2017
New Revision: 244208

URL: https://gcc.gnu.org/viewcvs?rev=244208&root=gcc&view=rev
Log:
PR bootstrap/79003
* Makefile.in (CFLAGS, CPPFLAGS, LDFLAGS): Remove -fno-lto.
(NOLTO_FLAGS): New variable.
(ALL_CFLAGS): Use it.
* configure.ac (nolto_flags): New ACX_PROG_CC_WARNING_OPTS,
check for whether -fno-lto works.
* configure: Regenerated.

Modified:
trunk/libdecnumber/ChangeLog
trunk/libdecnumber/Makefile.in
trunk/libdecnumber/configure
trunk/libdecnumber/configure.ac

[Bug testsuite/79026] New: The tests changed by revision r244006 now fail on darwin

2017-01-08 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79026

Bug ID: 79026
   Summary: The tests changed by revision r244006 now fail on
darwin
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: testsuite
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dominiq at lps dot ens.fr
CC: iains at gcc dot gnu.org, uros at gcc dot gnu.org
  Target Milestone: ---
  Host: x86_64-apple-darwin16
Target: x86_64-apple-darwin16
 Build: x86_64-apple-darwin16

After revision r244006 I see the following failures on darwin

FAIL: gcc.target/i386/pr78904-2.c scan-assembler [ \\t]addb[ \\t]+t[^\\n\\r]*,
%.h
FAIL: gcc.target/i386/pr78904-2.c scan-assembler [ \\t]andb[ \\t]+t[^\\n\\r]*,
%.h
FAIL: gcc.target/i386/pr78904-2.c scan-assembler [ \\t]orb[ \\t]+t[^\\n\\r]*,
%.h
FAIL: gcc.target/i386/pr78904-2.c scan-assembler [ \\t]xorb[ \\t]+t[^\\n\\r]*,
%.h
FAIL: gcc.target/i386/pr78904-4.c scan-assembler [ \\t]movb[\\t ]+%.h, t
FAIL: gcc.target/i386/pr78904-6.c scan-assembler [ \\t]movb[\\t ]*%.h, t
FAIL: gcc.target/i386/pr78967-2.c scan-assembler [ \\t]movb[ \\t]+t[^\\n\\r]*,
%.h

On darwin I see

andb%cl, %ah
orb %cl, %ah
xorb%cl, %ah
addb%cl, %ah

and

movb%ch, (%rax,%rsi)

The failures are silenced by the following patch

--- ../_clean/gcc/testsuite/gcc.target/i386/pr78904-2.c 2017-01-02
23:47:53.0 +0100
+++ gcc/testsuite/gcc.target/i386/pr78904-2.c   2017-01-08 15:38:34.0
+0100
@@ -18,7 +18,7 @@ struct S1 test_and (struct S1 a)
   return a;
 }

-/* { dg-final { scan-assembler "\[ \t\]andb\[ \t\]+t\[^\n\r]*, %.h" } } */
+/* { dg-final { scan-assembler "\[ \t\]andb\[ \t\]+t?\[^\n\r]*, %.h" } } */

 struct S1 test_or (struct S1 a)
 {
@@ -27,7 +27,7 @@ struct S1 test_or (struct S1 a)
   return a;
 }

-/* { dg-final { scan-assembler "\[ \t\]orb\[ \t\]+t\[^\n\r]*, %.h" } } */
+/* { dg-final { scan-assembler "\[ \t\]orb\[ \t\]+t?\[^\n\r]*, %.h" } } */

 struct S1 test_xor (struct S1 a)
 {
@@ -36,7 +36,7 @@ struct S1 test_xor (struct S1 a)
   return a;
 }

-/* { dg-final { scan-assembler "\[ \t\]xorb\[ \t\]+t\[^\n\r]*, %.h" } } */
+/* { dg-final { scan-assembler "\[ \t\]xorb\[ \t\]+t?\[^\n\r]*, %.h" } } */

 struct S1 test_add (struct S1 a)
 {
@@ -45,4 +45,4 @@ struct S1 test_add (struct S1 a)
   return a;
 }

-/* { dg-final { scan-assembler "\[ \t\]addb\[ \t\]+t\[^\n\r]*, %.h" } } */
+/* { dg-final { scan-assembler "\[ \t\]addb\[ \t\]+t?\[^\n\r]*, %.h" } } */
--- ../_clean/gcc/testsuite/gcc.target/i386/pr78904-4.c 2017-01-02
23:47:53.0 +0100
+++ gcc/testsuite/gcc.target/i386/pr78904-4.c   2017-01-08 15:43:24.0
+0100
@@ -18,4 +18,4 @@ void foo (struct S1 a, size_t i)
   t[i] = a.val;
 }

-/* { dg-final { scan-assembler "\[ \t\]movb\[\t \]+%.h, t" } } */
+/* { dg-final { scan-assembler "\[ \t\]movb\[\t \]+%.h, t?" } } */
--- ../_clean/gcc/testsuite/gcc.target/i386/pr78904-6.c 2017-01-02
23:47:53.0 +0100
+++ gcc/testsuite/gcc.target/i386/pr78904-6.c   2017-01-08 15:44:30.0
+0100
@@ -18,4 +18,4 @@ void foo (struct S1 a, size_t i)
   t[i] = a.val;
 }

-/* { dg-final { scan-assembler "\[ \t\]movb\[\t \]*%.h, t" } } */
+/* { dg-final { scan-assembler "\[ \t\]movb\[\t \]*%.h, t?" } } */
--- ../_clean/gcc/testsuite/gcc.target/i386/pr78967-2.c 2017-01-02
23:47:53.0 +0100
+++ gcc/testsuite/gcc.target/i386/pr78967-2.c   2017-01-08 15:52:19.0
+0100
@@ -21,4 +21,4 @@ struct S1 foo (struct S1 a, size_t i)
   return a;
 }

-/* { dg-final { scan-assembler "\[ \t\]movb\[ \t\]+t\[^\n\r]*, %.h" } } */
+/* { dg-final { scan-assembler "\[ \t\]movb\[ \t\]+t?\[^\n\r]*, %.h" } } */

[Bug translation/79019] translatable string typo in cif-code.def:141

2017-01-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79019

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-01-08
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
Created attachment 40477
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40477&action=edit
gcc7-pr79019.patch

Untested fix.

[Bug translation/79020] translatable string typo in params.def:1173

2017-01-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79020

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-01-08
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
Created attachment 40478
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40478&action=edit
gcc7-pr79019.patch

Untested fix.

[Bug target/69685] GCC cross compiler build failed

2017-01-08 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69685

Georg-Johann Lay  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |INVALID

--- Comment #6 from Georg-Johann Lay  ---
closed due to no feedback

[Bug testsuite/79026] The tests changed by revision r244006 now fail on darwin

2017-01-08 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79026

--- Comment #1 from Uroš Bizjak  ---
(In reply to Dominique d'Humieres from comment #0)
> After revision r244006 I see the following failures on darwin
> 
> FAIL: gcc.target/i386/pr78904-2.c scan-assembler [ \\t]addb[
> \\t]+t[^\\n\\r]*, %.h
> FAIL: gcc.target/i386/pr78904-2.c scan-assembler [ \\t]andb[
> \\t]+t[^\\n\\r]*, %.h
> FAIL: gcc.target/i386/pr78904-2.c scan-assembler [ \\t]orb[
> \\t]+t[^\\n\\r]*, %.h
> FAIL: gcc.target/i386/pr78904-2.c scan-assembler [ \\t]xorb[
> \\t]+t[^\\n\\r]*, %.h
> FAIL: gcc.target/i386/pr78904-4.c scan-assembler [ \\t]movb[\\t ]+%.h, t
> FAIL: gcc.target/i386/pr78904-6.c scan-assembler [ \\t]movb[\\t ]*%.h, t
> FAIL: gcc.target/i386/pr78967-2.c scan-assembler [ \\t]movb[
> \\t]+t[^\\n\\r]*, %.h
> 
> On darwin I see
> 
>   andb%cl, %ah
>   orb %cl, %ah
>   xorb%cl, %ah
>   addb%cl, %ah
> 
> and
> 
>   movb%ch, (%rax,%rsi)
> 
> The failures are silenced by the following patch

Just add:

/* { dg-require-effective-target nonpic } */

after dg-do directive.

Testing that symbols propagate into the pattern is the purpose of these tests.

The patch is pre-approved for mainline.

[Bug testsuite/79026] The tests changed by revision r244006 now fail on darwin

2017-01-08 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79026

--- Comment #2 from Uroš Bizjak  ---
(In reply to Uroš Bizjak from comment #1)

> The patch is pre-approved for mainline.

That is, the patch that adds dg-do directive only.

[Bug c++/53431] C++ preprocessor ignores #pragma GCC diagnostic

2017-01-08 Thread _hamlet at libero dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

Hamlet <_hamlet at libero dot it> changed:

   What|Removed |Added

 CC||_hamlet at libero dot it

--- Comment #29 from Hamlet <_hamlet at libero dot it> ---
For what it's worth, I confirm this (and bug 70888) with gcc 6.3.0 from
Gentoo/Linux.
In particular, the following program ("test.cpp"):

#pragma GCC diagnostic ignored "-Wlong-long"
const unsigned long long int ticks_per_day = 864LL;

compiled with `g++-6.3.0 -c -std=c++03 -pedantic -Werror test.cpp` (C++03
standard) issues an error:

test.cpp:2:46: error: use of C++11 long long integer constant
[-Werror=long-long]
 const unsigned long long int ticks_per_day = 864LL;
  ^

about the long long literal value, while it correctly suppresses the one about
the variable itself. Skipping the preprocessor (`-fpreprocessed`) does not
affect the outcome (the preprocessor correctly leaves the `#pragma` directive
untouched anyway). 
Using `-Wno-long-long` in the command line instead works as expected (but it's
not a viable solution when dealing with third party libraries).


Info on GCC:

Using built-in specs.
COLLECT_GCC=gcc-6.3.0
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/6.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-6.3.0/work/gcc-6.3.0/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/6.3.0
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/6.3.0
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/6.3.0/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/6.3.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/6.3.0/python
--enable-languages=c,c++,java,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 6.3.0 p1.0' --disable-esp --enable-libstdcxx-time
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64
--disable-altivec --disable-fixed-point --enable-targets=all --enable-libgomp
--disable-libmudflap --disable-libssp --disable-libcilkrts --disable-libmpx
--enable-vtable-verify --enable-libvtv --enable-lto --without-isl
--enable-libsanitizer --disable-default-pie --disable-default-ssp
Thread model: posix
gcc version 6.3.0 (Gentoo 6.3.0 p1.0)

[Bug testsuite/79026] The tests changed by revision r244006 now fail on darwin

2017-01-08 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79026

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-01-08
 Ever confirmed|0   |1

--- Comment #3 from Dominique d'Humieres  ---
> > The patch is pre-approved for mainline.
>
> That is, the patch that adds dg-do directive only.

Indeed!

[Bug middle-end/70831] [6/7 Regression] FTBFS: Build fails with bootstrap-lto and profiledbootstrap

2017-01-08 Thread t at sharklasers dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70831

JD  changed:

   What|Removed |Added

 CC||t at sharklasers dot com

--- Comment #9 from JD  ---
Compiling GCC 6.3 using GCC 6.3 (built without LTO):

export CFLAGS='-march=native -O3 -flto -fuse-linker-plugin
-fno-fat-lto-objects'
export CXXFLAGS=$CFLAGS
export LDFLAGS='-O3 -flto=4 -fuse-linker-plugin'

$gcc-6.3.0/configure --prefix=/home/local/gcc-6.3.0lto
--enable-languages=c,c++,fortran --enable-gold=yes --enable-ld=yes
--with-build-config=bootstrap-lto --disable-multilib

gcc-6.3.0/libmpx/mpxwrap/mpx_wrappers.c: In function
'__mpx_wrapper_malloc.chkp':
gcc-6.3.0/libmpx/mpxwrap/mpx_wrappers.c:36:9: internal compiler error: in
ultimate_transparent_alias_target, at varasm.c:1263
   void *p = (void *)malloc (size);
 ^
0x10eaf03 ultimate_transparent_alias_target
gcc-6.3.0/gcc/varasm.c:1263
0x10eb447 make_decl_rtl(tree_node*)
gcc-6.3.0/gcc/varasm.c:1349
0x8070d9 rtx_for_function_call
gcc-6.3.0/gcc/calls.c:1829
0x80a360 expand_call(tree_node*, rtx_def*, int)
gcc-6.3.0/gcc/calls.c:3162
0x7ee34a expand_builtin_with_bounds(tree_node*, rtx_def*, rtx_def*,
machine_mode, int)
gcc-6.3.0/gcc/builtins.c:6756
0x979710 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
gcc-6.3.0/gcc/expr.c:10622
0x96e220 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
gcc-6.3.0/gcc/expr.c:7969
0x9654c1 store_expr_with_bounds(tree_node*, rtx_def*, int, bool, bool,
tree_node*)
gcc-6.3.0/gcc/expr.c:5406
0x964262 expand_assignment(tree_node*, tree_node*, bool)
gcc-6.3.0/gcc/expr.c:5175
0x820bb3 expand_call_stmt
gcc-6.3.0/gcc/cfgexpand.c:2658
0x823ac1 expand_gimple_stmt_1
gcc-6.3.0/gcc/cfgexpand.c:3548
0x824198 expand_gimple_stmt
gcc-6.3.0/gcc/cfgexpand.c:3714
0x82b316 expand_gimple_basic_block
gcc-6.3.0/gcc/cfgexpand.c:5720
0x82cdd9 execute
gcc-6.3.0/gcc/cfgexpand.c:6335
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.

Bug 69791 might be related.

[Bug middle-end/77708] -Wformat-length %s warns for snprintf

2017-01-08 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77708

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Martin Sebor  ---
-Wformat-truncation added in r244210.

[Bug tree-optimization/78969] bogus snprintf truncation warning due to missing range info

2017-01-08 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78969

--- Comment #3 from Martin Sebor  ---
Author: msebor
Date: Sun Jan  8 23:42:09 2017
New Revision: 244210

URL: https://gcc.gnu.org/viewcvs?rev=244210&root=gcc&view=rev
Log:
PR tree-optimization/78913 - Probably misleading error reported by
-Wformat-length
PR middle-end/77708 - -Wformat-length %s warns for snprintf

gcc/ChangeLog:

PR middle-end/77708
* doc/invoke.texi (Warning Options): Document -Wformat-truncation.
* gimple-ssa-sprintf.c (call_info::reval_used, call_info::warnopt):
New member functions.
(format_directive): Used them.
(add_bytes): Same.
(pass_sprintf_length::handle_gimple_call): Same.
* graphite-sese-to-poly.c (tree_int_to_gmp): Increase buffer size
to avoid truncation for any argument.
(extract_affine_mul): Same.
* tree.c (get_file_function_name): Same.

gcc/c-family/ChangeLog:

PR middle-end/77708
* c.opt (-Wformat-truncation): New option.

gcc/fortran/ChangeLog:

PR tree-optimization/78913
PR middle-end/77708
* trans-common.c (build_equiv_decl): Increase buffer size to avoid
truncation for any argument.
* trans-types.c (gfc_build_logical_type): Same.

gcc/testsuite/ChangeLog:

PR middle-end/77708
* gcc.dg/tree-ssa/builtin-snprintf-warn-1.c: New test.
* gcc.dg/tree-ssa/builtin-snprintf-warn-2.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: XFAIL test cases failing
due to bug 78969.
* gcc.dg/format/pr78569.c: Adjust.


Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/doc/invoke.texi
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-common.c
trunk/gcc/fortran/trans-types.c
trunk/gcc/gimple-ssa-sprintf.c
trunk/gcc/graphite-sese-to-poly.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/format/pr78569.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-6.c
trunk/gcc/tree.c

[Bug middle-end/77708] -Wformat-length %s warns for snprintf

2017-01-08 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77708

--- Comment #3 from Martin Sebor  ---
Author: msebor
Date: Sun Jan  8 23:42:09 2017
New Revision: 244210

URL: https://gcc.gnu.org/viewcvs?rev=244210&root=gcc&view=rev
Log:
PR tree-optimization/78913 - Probably misleading error reported by
-Wformat-length
PR middle-end/77708 - -Wformat-length %s warns for snprintf

gcc/ChangeLog:

PR middle-end/77708
* doc/invoke.texi (Warning Options): Document -Wformat-truncation.
* gimple-ssa-sprintf.c (call_info::reval_used, call_info::warnopt):
New member functions.
(format_directive): Used them.
(add_bytes): Same.
(pass_sprintf_length::handle_gimple_call): Same.
* graphite-sese-to-poly.c (tree_int_to_gmp): Increase buffer size
to avoid truncation for any argument.
(extract_affine_mul): Same.
* tree.c (get_file_function_name): Same.

gcc/c-family/ChangeLog:

PR middle-end/77708
* c.opt (-Wformat-truncation): New option.

gcc/fortran/ChangeLog:

PR tree-optimization/78913
PR middle-end/77708
* trans-common.c (build_equiv_decl): Increase buffer size to avoid
truncation for any argument.
* trans-types.c (gfc_build_logical_type): Same.

gcc/testsuite/ChangeLog:

PR middle-end/77708
* gcc.dg/tree-ssa/builtin-snprintf-warn-1.c: New test.
* gcc.dg/tree-ssa/builtin-snprintf-warn-2.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: XFAIL test cases failing
due to bug 78969.
* gcc.dg/format/pr78569.c: Adjust.


Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/doc/invoke.texi
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-common.c
trunk/gcc/fortran/trans-types.c
trunk/gcc/gimple-ssa-sprintf.c
trunk/gcc/graphite-sese-to-poly.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/format/pr78569.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-6.c
trunk/gcc/tree.c

[Bug tree-optimization/78913] Probably misleading error reported by -Wformat-length

2017-01-08 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78913

--- Comment #10 from Martin Sebor  ---
Author: msebor
Date: Sun Jan  8 23:42:09 2017
New Revision: 244210

URL: https://gcc.gnu.org/viewcvs?rev=244210&root=gcc&view=rev
Log:
PR tree-optimization/78913 - Probably misleading error reported by
-Wformat-length
PR middle-end/77708 - -Wformat-length %s warns for snprintf

gcc/ChangeLog:

PR middle-end/77708
* doc/invoke.texi (Warning Options): Document -Wformat-truncation.
* gimple-ssa-sprintf.c (call_info::reval_used, call_info::warnopt):
New member functions.
(format_directive): Used them.
(add_bytes): Same.
(pass_sprintf_length::handle_gimple_call): Same.
* graphite-sese-to-poly.c (tree_int_to_gmp): Increase buffer size
to avoid truncation for any argument.
(extract_affine_mul): Same.
* tree.c (get_file_function_name): Same.

gcc/c-family/ChangeLog:

PR middle-end/77708
* c.opt (-Wformat-truncation): New option.

gcc/fortran/ChangeLog:

PR tree-optimization/78913
PR middle-end/77708
* trans-common.c (build_equiv_decl): Increase buffer size to avoid
truncation for any argument.
* trans-types.c (gfc_build_logical_type): Same.

gcc/testsuite/ChangeLog:

PR middle-end/77708
* gcc.dg/tree-ssa/builtin-snprintf-warn-1.c: New test.
* gcc.dg/tree-ssa/builtin-snprintf-warn-2.c: New test.
* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: XFAIL test cases failing
due to bug 78969.
* gcc.dg/format/pr78569.c: Adjust.


Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/doc/invoke.texi
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-common.c
trunk/gcc/fortran/trans-types.c
trunk/gcc/gimple-ssa-sprintf.c
trunk/gcc/graphite-sese-to-poly.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/format/pr78569.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-6.c
trunk/gcc/tree.c

[Bug middle-end/70831] [6/7 Regression] FTBFS: Build fails with bootstrap-lto and profiledbootstrap

2017-01-08 Thread t at sharklasers dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70831

--- Comment #10 from JD  ---
Same error without the linker plugin:

LDFLAGS=-O3 -flto=4
CXXFLAGS=-march=native -O3 -flto
CFLAGS=-march=native -O3 -flto

$gcc-6.3.0/configure --prefix=/home/local/gcc-6.3.0lto
--enable-languages=c,c++,fortran --enable-gold=yes --enable-ld=yes
--with-build-config=bootstrap-lto-noplugin --disable-multilib

[Bug c/79027] New: fold-const.c:11104:1: internal compiler error: Floating point exception

2017-01-08 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79027

Bug ID: 79027
   Summary: fold-const.c:11104:1: internal compiler error:
Floating point exception
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: danglin at gcc dot gnu.org
CC: deller at gmx dot de
  Target Milestone: ---
  Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
 Build: hppa-unknown-linux-gnu

Created attachment 40479
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40479&action=edit
Preprocessed source

The build fails on trunk:

/home/dave/gnu/gcc/objdir/./prev-gcc/xg++
-B/home/dave/gnu/gcc/objdir/./prev-gcc
/ -B/home/dave/opt/gnu/gcc/gcc-7/hppa-linux-gnu/bin/ -nostdinc++
-B/home/dave/gn
u/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/src/.libs
-B/home/dave/gnu/gcc/obj
dir/prev-hppa-linux-gnu/libstdc++-v3/libsupc++/.libs 
-I/home/dave/gnu/gcc/objdi
r/prev-hppa-linux-gnu/libstdc++-v3/include/hppa-linux-gnu 
-I/home/dave/gnu/gcc/
objdir/prev-hppa-linux-gnu/libstdc++-v3/include 
-I/home/dave/gnu/gcc/gcc/libstd
c++-v3/libsupc++
-L/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/sr
c/.libs
-L/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/libsupc++/.
libs -fno-PIE -c   -g -O2 -DIN_GCC -fno-exceptions -fno-rtti
-fasynchronous-
unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual
-Wmissing-form
at-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros 
-Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I.
-I../../gcc
/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include
-I../../gcc/gcc/../libcpp/incl
ude  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd
-I../li
bdecnumber -I../../gcc/gcc/../libbacktrace   -o fold-const.o -MT fold-const.o
-M
MD -MP -MF ./.deps/fold-const.TPo ../../gcc/gcc/fold-const.c
../../gcc/gcc/fold-const.c: In function ‘tree_node* fold_binary_loc(location_t, 
tree_code, tree, tree, tree)’:
../../gcc/gcc/fold-const.c:11104:1: internal compiler error: Floating point
exce
ption
 }
 ^
0x14fb0af crash_signal../../gcc/gcc/toplev.c:333

With "-v -save-temps", more errors appear:

dave@MACPRO:~$ cat xx.log
Reading specs from /home/dave/gnu/gcc/objdir/./prev-gcc/specs
COLLECT_GCC=/home/dave/gnu/gcc/objdir/./prev-gcc/xg++
Target: hppa-linux-gnu
Configured with: ../gcc/configure --with-gnu-as --with-gnu-ld --enable-shared
--enable-multiarch --enable-linker-build-id --build=hppa-linux-gnu
--host=hppa-linux-gnu --target=hppa-linux-gnu
--prefix=/home/dave/opt/gnu/gcc/gcc-7 --with-local-prefix=/home/dave/opt/gnu
--enable-threads=posix --enable-__cxa_atexit --build=hppa-linux-gnu
--enable-clocale=gnu --enable-languages=c,c++,objc,fortran,obj-c++,ada,lto,go
Thread model: posix
gcc version 7.0.0 20170108 (experimental) [trunk revision 244209] (GCC) 
COLLECT_GCC_OPTIONS='-B' '/home/dave/gnu/gcc/objdir/./prev-gcc/' '-B'
'/home/dave/opt/gnu/gcc/gcc-7/hppa-linux-gnu/bin/' '-nostdinc++' '-B'
'/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/src/.libs' '-B'
'/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/libsupc++/.libs'
'-I'
'/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/include/hppa-linux-gnu'
'-I' '/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/include' '-I'
'/home/dave/gnu/gcc/gcc/libstdc++-v3/libsupc++'
'-L/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/src/.libs'
'-L/home/dave/gnu/gcc/objdir/prev-hppa-linux-gnu/libstdc++-v3/libsupc++/.libs'
'-fno-PIE' '-c' '-g' '-O2' '-D' 'IN_GCC' '-fno-exceptions' '-fno-rtti'
'-fasynchronous-unwind-tables' '-Wextra' '-Wall' '-Wno-narrowing'
'-Wwrite-strings' '-Wcast-qual' '-Wsuggest-attribute=format'
'-Woverloaded-virtual' '-Wpedantic' '-Wno-long-long' '-Wno-variadic-macros'
'-Wno-overlength-strings' '-Werror' '-fno-common' '-D' 'HAVE_CONFIG_H' '-I' '.'
'-I' '.' '-I' '../../gcc/gcc' '-I' '../../gcc/gcc/.' '-I'
'../../gcc/gcc/../include' '-I' '../../gcc/gcc/../libcpp/include' '-I'
'../../gcc/gcc/../libdecnumber' '-I' '../../gcc/gcc/../libdecnumber/dpd' '-I'
'../libdecnumber' '-I' '../../gcc/gcc/../libbacktrace' '-o' 'fold-const.o'
'-MT' &#x

[Bug ipa/78644] [7 Regression] ICE: SIGSEGV in is_gimple_reg_type with -Og -fipa-cp

2017-01-08 Thread tbsaunde at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78644

tbsaunde at gcc dot gnu.org changed:

   What|Removed |Added

 CC||tbsaunde at gcc dot gnu.org

--- Comment #5 from tbsaunde at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #4)
> Verified reverting the tree-ssa-ccp.c hunk of r242920 makes the ICE go away
> (then instead of _18 = _7 + _17; there is _18 = x2_3 + _17;
> (no idea why _7 hasn't actually been replaced with 0 but just with x2_3,
> though there is UB involved in the loop if x4[0] isn't 0 at the beginning)).

I think that is because match.pd doesn't have a pattern for x / 0, and nothing
else that would clean it up is run with -Og.

What happens is basically this, we first evaluate blocks in the order 2 4 5 3
4.  So we first add _7 = 0, _15 = {0, 0, 0, 0}, _16 = 0, and _18 = _17 to the
latice.  Then when we evaluate block 3 we set x2_4 to varying, and leave x3_2
as 0.  Then we meet x2_4 and 0 and set _7 = x2_4 in the latice.  Then when we
try and evaluate _15 = {_7, _7, _7, _7} we fail to meet the new value of {x2_4,
x2_4, x2_4, x2_4} and the old {0, 0, 0, 0} because set_latice_value doesn't
know how to handle meeting vector constants like that.  Then evaluating _16 =
BIT_FIELD_REF<_15, 128, 0> we enter _16 = _7 into the latice because
gimple_simplify doesn't try to valueize _7.  Then substitute_and_fold visits
the statement using _16 and replaces it with _7 and doesn't check if _7 should
also be replaced there.

It seems like there is basically 3 options for fixing this.
- make gimple_simplify try to simplify the ssa name it gets out of the vector
cst, but I guess the design is that should already be simplified.
- in get_constant_value if const_val[i] is a ssa name look up the value of that
ssa name.  That seems simplest and least prone to other issues, but maybe there
is a need for all entries in const_val[] to be completely simplified?
- make set_latice_value and ccp_latice_meet correctly merge the 2 vector csts. 
I'm not completely sure if that's even possible in all cases with vectors that
have different elements.

[Bug other/16519] -pthread undocumented

2017-01-08 Thread sandra at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16519

--- Comment #4 from sandra at gcc dot gnu.org ---
Author: sandra
Date: Mon Jan  9 02:39:24 2017
New Revision: 244214

URL: https://gcc.gnu.org/viewcvs?rev=244214&root=gcc&view=rev
Log:
2017-01-08  Sandra Loosemore  

PR other/16519

gcc/
* doc/invoke.texi (Option Summary): Move -pthread to Linker Options
and Preprocessor Options.
(Options for Linking): Document -pthread here
(RS/6000 and PowerPC Options): ...not here.
(Solaris 2 Options): ...or here.
* doc/cppopts.texi: Document -pthread.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/cppopts.texi
trunk/gcc/doc/invoke.texi

[Bug other/16519] -pthread undocumented

2017-01-08 Thread sandra at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16519

sandra at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from sandra at gcc dot gnu.org ---
Fixed for GCC 7.

[Bug middle-end/17660] manual's description of __attribute__((mode)) is poor, arrangement is confusing

2017-01-08 Thread sandra at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17660

--- Comment #2 from sandra at gcc dot gnu.org ---
Author: sandra
Date: Mon Jan  9 03:06:23 2017
New Revision: 244215

URL: https://gcc.gnu.org/viewcvs?rev=244215&root=gcc&view=rev
Log:
2017-01-08  Sandra Loosemore  

PR middle-end/17660

gcc/
* extend.texi (Common Variable Attributes): Add xref to GCC
Internals manual to explain mode attribute keywords.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/extend.texi

[Bug middle-end/17660] manual's description of __attribute__((mode)) is poor, arrangement is confusing

2017-01-08 Thread sandra at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17660

sandra at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 CC||sandra at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #3 from sandra at gcc dot gnu.org ---
Problem (1) now fixed for GCC 7.

Problem (2) has already been fixed by one of my previous organization changes;
now all the attribute-related sections are grouped together.

[Bug middle-end/32003] Undocumented -fdump-tree options

2017-01-08 Thread sandra at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32003

sandra at gcc dot gnu.org changed:

   What|Removed |Added

 CC||sandra at gcc dot gnu.org

--- Comment #5 from sandra at gcc dot gnu.org ---
Given how bloated the GCC user manual is already (it takes almost 20 pages just
to *list* all the options), I'd prefer trimming all the dump-related option
documentation to something short and generic with a pointer to the GCC
internals manual for a full list of the pass names and what they do.  Ordinary
users have little reason to use these options, and understanding the dump
output requires some familiarity with GCC internals anyway.

[Bug bootstrap/78880] [7 Regression] Revision 243196 breaks bootstrap on x86_64-w64-mingw32

2017-01-08 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78880

Jeffrey A. Law  changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|INVALID |---

--- Comment #4 from Jeffrey A. Law  ---
Opps, totally goof'd this one.

[Bug c/79028] New: Un-optimal/ incorrect forward propagation

2017-01-08 Thread pitchumani.s at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79028

Bug ID: 79028
   Summary: Un-optimal/ incorrect forward propagation
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: pitchumani.s at hotmail dot com
  Target Milestone: ---

test case: (options: -Os)
typedef unsigned int uint8_t __attribute__((__mode__(__QI__))); 
typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));
typedef struct rpl_instance rpl_instance_t;
struct rpl_instance {
  uint8_t dio_intcurrent;
  uint32_t dio_next_delay;
};
unsigned short random_rand(void);

void
new_dio_interval(rpl_instance_t *instance)
{
  uint32_t time;
  uint32_t ticks;
  time = 1UL << instance->dio_intcurrent;
  ticks = (time * 128) / 1000;
  instance->dio_next_delay = ticks;
  ticks = ticks / 2 + (ticks / 2 * (uint32_t)random_rand()) / 65535U;
  instance->dio_next_delay -= ticks;
}

tree dump before and after optimizations
(snip from ssa dump)
 _1 = instance_14(D)->dio_intcurrent;
 _2 = (int) _1;
 _3 = 1 << _2;
 time_15 = (uint32_t) _3;
 _4 = time_15 * 128;
 ticks_16 = _4 / 1000;
 instance_14(D)->dio_next_delay = ticks_16;
 _5 = ticks_16 / 2;
 _6 = ticks_16 / 2;
 _7 = random_rand ();
 _8 = (unsigned int) _7;
 _9 = _6 * _8;
 _10 = _9 / 65535;
 ticks_19 = _5 + _10;
 _11 = instance_14(D)->dio_next_delay;
 _12 = _11 - ticks_19;
 instance_14(D)->dio_next_delay = _12;
 return;
(snip)

gcc-7 propagates ticks_16 to definitions of _5 and _6 as part of forwprop1
pass. It contradicts the  descriptions "substituting variables that are used
once into the expression".

(snip from optimized dump)
   [100.00%]:
  _1 = instance_13(D)->dio_intcurrent;
  _2 = (int) _1;
  _3 = 1 << _2;
  time_14 = (uint32_t) _3;
  _4 = time_14 * 128;
  ticks_15 = _4 / 1000;
  instance_13(D)->dio_next_delay = ticks_15;
  _5 = _4 / 2000;
  _6 = random_rand ();
  _7 = (unsigned int) _6;
  _8 = _5 * _7;
  _9 = _8 / 65535;
  _10 = instance_13(D)->dio_next_delay;
  _23 = _10 - _5;
  _11 = _23 - _9;
  instance_13(D)->dio_next_delay = _11;
  return;
(snip)

Without that forward propagation, _5 would be _5 = ticks_15 >> 1, that is
optimal than the current code.
Till gcc-4 it was optimal for this case, got changed gcc-5 onwards.