[Bug tree-optimization/90004] [graphite] ICE: Segmentation fault (in scop_get_dependences(scop*))

2019-10-05 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90004

Arseny Solokha  changed:

   What|Removed |Added

 Target|powerpc-*-linux-gnu |

--- Comment #2 from Arseny Solokha  ---
Now I can reproduce it w/ the current gcc 10 snapshot when compiling the
following testcase for x86_64 using isl 0.21:

int *
w3 (int *b9, int l2)
{
  const int j9 = 8;
  int mq, fv;
  double dd = 0.0;
  double px[2];

  for (mq = 0; mq < j9; ++mq)
dd += b9[mq * j9];

  px[0] = dd;
  for (fv = 0; fv < j9; ++fv)
for (mq = 0; mq < j9; ++mq)
  b9[mq * j9 + fv] = px[l2];

  return b9;
}

% x86_64-unknown-linux-gnu-gcc-10.0.0-alpha20190929 -O3 -floop-nest-optimize
-fwrapv-pointer -c nmyaunhz.c
during GIMPLE pass: graphite
nmyaunhz.c: In function 'w3':
nmyaunhz.c:2:1: internal compiler error: Segmentation fault
2 | w3 (int *b9, int l2)
  | ^~
0xd6e74e crash_signal
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/toplev.c:326
0x15f2165 scop_get_dependences(scop*)
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite-dependences.c:316
0x15f2568 optimize_isl
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite-optimize-isl.c:126
0x15f2568 apply_poly_transforms(scop*)
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite-optimize-isl.c:212
0x15ec615 graphite_transform_loops()
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite.c:468
0x15ed3c6 graphite_transforms
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite.c:538
0x15ed3c6 execute
   
/var/tmp/portage/sys-devel/gcc-10.0.0_alpha20190929/work/gcc-10-20190929/gcc/graphite.c:615

[Bug target/59888] Darwin linker error "illegal text-relocation" with -shared

2019-10-05 Thread iains at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59888

--- Comment #17 from Iain Sandoe  ---
by the way, I haven't been able to find a C reproducer for this issue - if you
feel we should have a testcase for it perhaps a link test for the fortran
example would work?

[Bug tree-optimization/91914] [9 Regression] Invalid strlen optimization

2019-10-05 Thread guillaume at morinfr dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91914

--- Comment #5 from Guillaume Morin  ---
Just FYI, we've hit the same wrong-code bug compiling our codebase. And I can
confirm that the patch in comment #2 does fix the problem for us as well.

[Bug other/91209] gm2 bootstrap comparison failure

2019-10-05 Thread gaiusmod2 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91209

Gaius Mulley  changed:

   What|Removed |Added

 CC||gaiusmod2 at gmail dot com

--- Comment #4 from Gaius Mulley  ---
yes a bug as gcc/gm2/gm2-compiler-boot/M2Version.c is machine generated and it
contains the time of day in a C string.  This object file should be omitted
from the stage diffs.

[Bug fortran/92004] [10 Regression] Rejection of different ranks for dummy array argument where actual argument is an element

2019-10-05 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92004

Thomas Koenig  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-10-05
   Assignee|unassigned at gcc dot gnu.org  |tkoenig at gcc dot 
gnu.org
 Ever confirmed|0   |1

[Bug fortran/92004] New: [10 Regression] Rejection of different ranks for dummy array argument where actual argument is an element

2019-10-05 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92004

Bug ID: 92004
   Summary: [10 Regression] Rejection of different ranks for dummy
array argument where actual argument is an element
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

From F18, 15.5.2.4 Ordinary dummy variables

14 If the actual argument is a noncoindexed scalar, the
corresponding dummy argument shall be scalar unless the actual
argument is default character, of type character with the
C character kind (18.2.2), or is an element or substring of an
element of an array that is not an assumed-shape, pointer, or
polymorphic array, the dummy argument has assumed-rank, or the
dummy argument is an assumed-type assumed-size array. 

So, this is actually legal:

subroutine baz
  real x(10,10)
  call bar(x(2,2))
  call bar(x)
end subroutine baz

[Bug fortran/92000] Fortran array passing optimization

2019-10-05 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92000

Thomas Koenig  changed:

   What|Removed |Added

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

--- Comment #1 from Thomas Koenig  ---
This would be invalid after all, storage association and all...

[Bug preprocessor/89808] An option to disable warning "#pragma once in main file"

2019-10-05 Thread martin at log2 dot ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89808

martin at log2 dot ch  changed:

   What|Removed |Added

 CC||martin at log2 dot ch

--- Comment #10 from martin at log2 dot ch  ---
Just adding a second use-case.

Emacs with cmake-ide (using flycheck) shows warnings that update as you type.
They are generated by running the file through gcc, which could be a .hpp file.
This usually works well enough for interactive use. But it leaves you with an
irrelevant "#pragma once in main file" warning in the editor.

(Not sure if this whole setup is "legit", or if there are better alternatives.
It involves guessing which compile flags of some .cpp file belong to the .hpp
file being edited.)

[Bug c++/91364] Implement P0388R4: Permit conversions to arrays of unknown bound

2019-10-05 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91364

--- Comment #4 from Marek Polacek  ---
Note to myself: while messing with this, perhaps implement DR 330 too for good
measure.  Bug 88128.

[Bug libstdc++/47045] NetBSD: define changes in ctype.h

2019-10-05 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47045

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #11 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #10)
> Author: kargl
> Date: Sat Oct  5 15:23:26 2019
> New Revision: 276627
> 
> URL: https://gcc.gnu.org/viewcvs?rev=276627=gcc=rev
> Log:
> 2019-10-05  Steven G. Kargl  
> 
>   PR fortran/47045
>   * decl.c (variable_decl): Do not search parent namespace for symbol.
> 
> 2019-10-05  Steven G. Kargl  
> 
>   PR fortran/47045
>   * gfortran.dg/pr47054_1.f90: New test
>   * gfortran.dg/pr47054_2.f90: Ditto.
> 

Whoops.  Transposes 47054 to 47045.  Sorry about that.

[Bug fortran/47054] Compilation error when cray pointers are declared in both host and internal subroutines

2019-10-05 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47054

kargl at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #8 from kargl at gcc dot gnu.org ---
Fixed on trunk and 9-branch.  Closing.
Sorry about the long delay in finding
the bug.  Thanks for the bug report.

[Bug fortran/47054] Compilation error when cray pointers are declared in both host and internal subroutines

2019-10-05 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47054

--- Comment #7 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Sat Oct  5 15:42:25 2019
New Revision: 276628

URL: https://gcc.gnu.org/viewcvs?rev=276628=gcc=rev
Log:
2019-10-05  Steven G. Kargl  

PR fortran/47054
* decl.c (variable_decl): Do not search parent namespace for symbol.

2019-10-05  Steven G. Kargl  

PR fortran/47054
* gfortran.dg/pr47054_1.f90: New test
* gfortran.dg/pr47054_2.f90: Ditto.

Added:
branches/gcc-9-branch/gcc/testsuite/gfortran.dg/pr47054_1.f90
branches/gcc-9-branch/gcc/testsuite/gfortran.dg/pr47054_2.f90
Modified:
branches/gcc-9-branch/gcc/fortran/ChangeLog
branches/gcc-9-branch/gcc/fortran/decl.c
branches/gcc-9-branch/gcc/testsuite/ChangeLog

[Bug c++/92003] New: constexpr-ness of char const* doesn't propagate

2019-10-05 Thread vincent.hamp at higaski dot at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92003

Bug ID: 92003
   Summary: constexpr-ness of char const* doesn't propagate
   Product: gcc
   Version: 9.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: vincent.hamp at higaski dot at
  Target Milestone: ---

For some reasons the compiler seems to differ between a constexpr char const*
which is directly initialized by a string literal and one which actually points
to a constexpr char array.

The last expression in the following code-snippet fails to compile on the
current trunk:

constexpr char const* get_c_str() { return "abc"; }
constexpr bool use_get_c_str_in_constexpr_context{get_c_str()}; // works

template 
struct string {
  static constexpr char const* c_str() { return [0]; }

 private:
  static constexpr char c[]{Cs..., '\0'};
};

constexpr char const* cstr{string<'a', 'b', 'c'>::c_str()};
constexpr bool use_cstr_in_constexpr_context{cstr}; // doesn't work


https://godbolt.org/z/k3TBUC

[Bug libstdc++/47045] NetBSD: define changes in ctype.h

2019-10-05 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47045

--- Comment #10 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Sat Oct  5 15:23:26 2019
New Revision: 276627

URL: https://gcc.gnu.org/viewcvs?rev=276627=gcc=rev
Log:
2019-10-05  Steven G. Kargl  

PR fortran/47045
* decl.c (variable_decl): Do not search parent namespace for symbol.

2019-10-05  Steven G. Kargl  

PR fortran/47045
* gfortran.dg/pr47054_1.f90: New test
* gfortran.dg/pr47054_2.f90: Ditto.

Added:
trunk/gcc/testsuite/gfortran.dg/pr47054_1.f90
trunk/gcc/testsuite/gfortran.dg/pr47054_2.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/decl.c
trunk/gcc/testsuite/ChangeLog

[Bug bootstrap/92002] [10 regression] -Wuninitialized warning in gcc/wide-int.cc

2019-10-05 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92002

Rainer Orth  changed:

   What|Removed |Added

   Target Milestone|--- |10.0

[Bug bootstrap/92002] New: [10 regression] -Wuninitialized warning in gcc/wide-int.cc

2019-10-05 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92002

Bug ID: 92002
   Summary: [10 regression] -Wuninitialized warning in
gcc/wide-int.cc
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: bootstrap
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ro at gcc dot gnu.org
  Target Milestone: ---
Target: sparcv9-sun-solaris2.11

Within the last week (between 20190927 (r276175) and 20191004 (r276564)),
64-bit Solaris/SPARC bootstrap got broken in stage2:

/vol/gcc/src/hg/trunk/local/gcc/wide-int.cc: In function 'void
selftest::test_ops() [with VALUE_TYPE = generic_wide_int]':
/vol/gcc/src/hg/trunk/local/gcc/wide-int.cc:2294:25: error:
'.generic_wide_int::.wide_int_storage::val[1]'
is used uninitialized in this function [-Werror=uninitialized]
 2294 |   return wi::shwi (i, 32);
  | ^
/vol/gcc/src/hg/trunk/local/gcc/wide-int.cc:2294:25: error:
'.generic_wide_int::.wide_int_storage::val[2]'
is used uninitialized in this function [-Werror=uninitialized]
/vol/gcc/src/hg/trunk/local/gcc/wide-int.cc:2294:25: error:
'.generic_wide_int::.wide_int_storage::val[1]'
is used uninitialized in this function [-Werror=uninitialized]
 2294 |   return wi::shwi (i, 32);
  | ^
/vol/gcc/src/hg/trunk/local/gcc/wide-int.cc:2294:25: error:
'.generic_wide_int::.wide_int_storage::val[2]'
is used uninitialized in this function [-Werror=uninitialized]
/vol/gcc/src/hg/trunk/local/gcc/wide-int.cc: In function 'void
selftest::test_comparisons() [with VALUE_TYPE =
generic_wide_int]':
/vol/gcc/src/hg/trunk/local/gcc/wide-int.cc:2294:25: error:
'.generic_wide_int::.wide_int_storage::val[1]'
is used uninitialized in this function [-Werror=uninitialized]
 2294 |   return wi::shwi (i, 32);
  | ^
/vol/gcc/src/hg/trunk/local/gcc/wide-int.cc:2294:25: error:
'.generic_wide_int::.wide_int_storage::val[2]'
is used uninitialized in this function [-Werror=uninitialized]
/vol/gcc/src/hg/trunk/local/gcc/wide-int.cc:2294:25: error:
'.generic_wide_int::.wide_int_storage::val[1]'
is used uninitialized in this function [-Werror=uninitialized]
 2294 |   return wi::shwi (i, 32);
  |   

/vol/gcc/src/hg/trunk/local/gcc/tree-ssanames.c: In function 'wide_int
get_nonzero_bits(const_tree)':
/vol/gcc/src/hg/trunk/local/gcc/tree-ssanames.c:527:46: error:
'.generic_wide_int::.wide_int_storage::val[1]'
may be used uninitialized in this function [-Werror=maybe-uninitialized]
  527 | | (HOST_WIDE_INT) pi->misalign, precision);
  |  ^
/vol/gcc/src/hg/trunk/local/gcc/tree-ssanames.c:527:46: error:
'.generic_wide_int::.wide_int_storage::val[2]'
may be used uninitialized in this function [-Werror=maybe-uninitialized]
/vol/gcc/src/hg/trunk/local/gcc/tree-ssanames.c:528:37: error:
'.generic_wide_int::.wide_int_storage::val[1]'
may be used uninitialized in this function [-Werror=maybe-uninitialized]
  528 |   return wi::shwi (-1, precision);
  | ^
/vol/gcc/src/hg/trunk/local/gcc/tree-ssanames.c:528:37: error:
'.generic_wide_int::.wide_int_storage::val[2]'
may be used uninitialized in this function [-Werror=maybe-uninitialized]
/vol/gcc/src/hg/trunk/local/gcc/tree-ssanames.c:533:35: error:
'.generic_wide_int::.wide_int_storage::val[1]'
may be used uninitialized in this function [-Werror=maybe-uninitialized]
  533 | return wi::shwi (-1, precision);
  |   ^

I cannot yet make sense of this.

[Bug c++/91364] Implement P0388R4: Permit conversions to arrays of unknown bound

2019-10-05 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91364

Marek Polacek  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #3 from Marek Polacek  ---
https://gcc.gnu.org/ml/gcc-patches/2019-10/msg00395.html

[Bug fortran/91497] -Wconversion warns when doing explicit type conversion

2019-10-05 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91497

--- Comment #22 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Sat Oct  5 14:27:26 2019
New Revision: 276626

URL: https://gcc.gnu.org/viewcvs?rev=276626=gcc=rev
Log:
2019-10-05  Steven G. Kargl  

PR fortran/91497
* gfortran.dg/pr91497.f90: Run on i?86-*-* and x86_64-*-* only.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/pr91497.f90

[Bug rtl-optimization/91994] [10 Regression] r276327 breaks -mvzeroupper

2019-10-05 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91994

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||rsandifo at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |rsandifo at gcc dot 
gnu.org

--- Comment #6 from rsandifo at gcc dot gnu.org  
---
Mine.  See https://gcc.gnu.org/ml/gcc-patches/2019-10/msg00416.html for some
thoughts about how to fix this.

[Bug c++/92001] New: missing -Wclass-memaccess with array as first argument to memset

2019-10-05 Thread sbergman at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92001

Bug ID: 92001
   Summary: missing -Wclass-memaccess with array as first argument
to memset
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: sbergman at redhat dot com
CC: msebor at gcc dot gnu.org
  Target Milestone: ---

With at least both GCC 9.2.1 and recent trunk towards GCC 10,

  #include 
  struct S { S(); };
  void f() {
S s[1];
std::memset(s, 0, sizeof s);
  }

does not emit a -Wclass-memaccess (but it does when you change s to be of
non-array type).

(See

"Drop bogus memsets" for a real-life case of such a false negative.  There were
about half a dozen similar cases across the LibreOffice code base.)

[Bug fortran/92000] Fortran array passing optimization

2019-10-05 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92000

Thomas Koenig  changed:

   What|Removed |Added

Version|unknown |10.0
   Severity|normal  |enhancement

[Bug fortran/92000] New: Fortran array passing optimization

2019-10-05 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92000

Bug ID: 92000
   Summary: Fortran array passing optimization
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

The following code

  program main
  integer :: a(2)
  a(1) = 1
  a(2) = 42
  call foo(a(1:1),1)
  if (a(2) .ne. 42) stop "bletchful"
  end

need not execute the check if a(2) is 42, and the call to
_gfortran_stop_string can be optimized away.

The same goes for

  program main
  integer :: a(2)
  a(1) = 1
  a(2) = 42
  call foo(a(1),1)
  if (a(2) .ne. 42) stop "bletchful"
  end

There is a lot of broken code which assumes that the check is necessary,
so we should probably do this optimization contingent only if
-fallow-argument-mismatch is not in effect.

[Bug pch/17162] warning about invalid precompiled header even if the correct one is used

2019-10-05 Thread guriev-ns at ya dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17162

Nicholas Guriev  changed:

   What|Removed |Added

 CC||guriev-ns at ya dot ru

--- Comment #4 from Nicholas Guriev  ---
*** Bug 91999 has been marked as a duplicate of this bug. ***

[Bug pch/91999] pch_open_file picks up a first found precompiled header even if it's not suitable

2019-10-05 Thread guriev-ns at ya dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91999

Nicholas Guriev  changed:

   What|Removed |Added

 Resolution|INVALID |DUPLICATE

--- Comment #3 from Nicholas Guriev  ---


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

[Bug pch/91999] pch_open_file picks up a first found precompiled header even if it's not suitable

2019-10-05 Thread guriev-ns at ya dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91999

--- Comment #2 from Nicholas Guriev  ---
Thank you for the clarification. The diagnostic message looks like no pch is
used at all that results in a misunderstanding.

At an end-user point of view, the -Winvalid-pch flag isn't so valuable. Who
cares in which way a correct pch has been discovered and how many invalid files
were found before?

[Bug jit/91928] libgccjit fails on subsequent compilations in ipa-cp

2019-10-05 Thread akrl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91928

--- Comment #2 from akrl at gcc dot gnu.org ---
Author: akrl
Date: Sat Oct  5 09:02:25 2019
New Revision: 276625

URL: https://gcc.gnu.org/viewcvs?rev=276625=gcc=rev
Log:
Backport fix for PR jit/91928

gcc/ChangeLog

2019-10-05  Andrea Corallo  

Backport from mainline
2019-10-03  Andrea Corallo  
* gcc/ipa-cp.c (ipa_cp_c_finalize): Release ipcp_transformation_sum
when finished.
* ipa-prop.c (ipcp_free_transformation_sum): New function.
* ipa-prop.h (ipcp_free_transformation_sum): Add declaration.


Modified:
branches/gcc-9-branch/gcc/ChangeLog
branches/gcc-9-branch/gcc/ipa-cp.c
branches/gcc-9-branch/gcc/ipa-prop.c
branches/gcc-9-branch/gcc/ipa-prop.h

[Bug pch/91999] pch_open_file picks up a first found precompiled header even if it's not suitable

2019-10-05 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91999

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
-Winvalid-pch is doing exactly what it should be doing based on what it is
documented to do:
Warn if a precompiled header (see Precompiled Headers) is found in the search
path but cannot be used.


In the C case, all.h.gch/.c is found first but it can be used so it does not
check others.
In the C++ case, all.h.gch/.c is found first and you have -Winvalid-pch on so
it warns (you have -Werror on so it changed to an error instead).

all.h.gch/.c++ is still used though :).

[Bug pch/91999] New: pch_open_file picks up a first found precompiled header even if it's not suitable

2019-10-05 Thread guriev-ns at ya dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91999

Bug ID: 91999
   Summary: pch_open_file picks up a first found precompiled
header even if it's not suitable
   Product: gcc
   Version: 9.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: pch
  Assignee: unassigned at gcc dot gnu.org
  Reporter: guriev-ns at ya dot ru
  Target Milestone: ---

In the following example g++ uses C precompiled header if it exists, although
there is a C++ precompiled header nearby in the all.h.gch directory. The error
occurs when -Winvalid-pch is set and there is a precompiled header for C in
.gch directory.


mymedia@barberry:/tmp/tmp.uz5iSoQUFL$ head *
==> all.h <==
#ifndef __cplusplus
# include 
#else
# include 
#endif

==> t1.c <==
#include "all.h"

int main (void)
{
  printf("Hello!\n");
  return 0;
}

==> t2.C <==
#include "all.h"

int main()
{
  std::cout << "Hello!" << std::endl;
}
mymedia@barberry:/tmp/tmp.uz5iSoQUFL$ mkdir all.h.gch
mymedia@barberry:/tmp/tmp.uz5iSoQUFL$ gcc-9 -Werror -Wall -Wextra -x c-header
all.h -o all.h.gch/.c
mymedia@barberry:/tmp/tmp.uz5iSoQUFL$ g++-9 -Werror -Wall -Wextra -x c++-header
all.h -o all.h.gch/.c++
mymedia@barberry:/tmp/tmp.uz5iSoQUFL$ gcc-9 -Werror -Wall -Wextra -Winvalid-pch
t1.c -o t1.out
mymedia@barberry:/tmp/tmp.uz5iSoQUFL$ g++-9 -Werror -Wall -Wextra -Winvalid-pch
t2.C -o t2.out
t2.C:1:17: error: all.h.gch/.c: not for GNU C++14 [-Werror]
1 | #include "all.h"
  | ^
cc1plus: all warnings being treated as errors
mymedia@barberry:/tmp/tmp.uz5iSoQUFL$ gcc-9 -v
Using built-in specs.
COLLECT_GCC=gcc-9
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 9.2.1-8'
--with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-9
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--with-target-system-zlib=auto --enable-multiarch --disable-werror
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.2.1 20190909 (Debian 9.2.1-8)

[Bug c++/91987] -fstrict-eval-order issues

2019-10-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91987

--- Comment #9 from Jakub Jelinek  ---
Another testcase for the same reason as above:
int a[4] = { 1, 2, 3, 4 };
int c;

int
main ()
{
  int *x = a;
  c = 1;
  int r = (c = 4, x)[(c *= 2, 3)];
  if (c != 8 || r != 3)
__builtin_abort ();
  c = 1;
  r = (c = 3, 2)[(c *= 2, x)];
  if (c != 6 || r != 2)
__builtin_abort ();
}

If we want to represent E1[E2] for non-array E1/E2 as *(E1+E2), we need to
force the evaluation of E1's side-effects, but not just those seen under
TREE_SIDE_EFFECTS, some other way.  Perhaps SAVE_EXPR, *(SAVE_EXPR+E2).
Thoughts on this?

[Bug fortran/91926] assumed rank optional

2019-10-05 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91926

--- Comment #3 from Paul Thomas  ---
Author: pault
Date: Sat Oct  5 08:17:55 2019
New Revision: 276624

URL: https://gcc.gnu.org/viewcvs?rev=276624=gcc=rev
Log:
2019-10-05  Paul Thomas  

PR fortran/91926
* trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Correct the
assignment of the attribute field to account correctly for an
assumed shape dummy. Assign separately to the gfc and cfi
descriptors since the atribute can be different. Add btanch to
correctly handle missing optional dummies.

2019-10-05  Paul Thomas  

PR fortran/91926
* gfortran.dg/ISO_Fortran_binding_13.f90 : New test.
* gfortran.dg/ISO_Fortran_binding_13.c : Additional source.
* gfortran.dg/ISO_Fortran_binding_14.f90 : New test.

2019-10-05  Paul Thomas  

PR fortran/91926
* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Do not
modify the bounds and offset for CFI_other.

Added:
trunk/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_13.c
trunk/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_13.f90
trunk/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_14.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog
trunk/libgfortran/ChangeLog
trunk/libgfortran/runtime/ISO_Fortran_binding.c

[Bug target/59888] Darwin linker error "illegal text-relocation" with -shared

2019-10-05 Thread iains at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59888

--- Comment #16 from Iain Sandoe  ---
Author: iains
Date: Sat Oct  5 08:05:44 2019
New Revision: 276623

URL: https://gcc.gnu.org/viewcvs?rev=276623=gcc=rev
Log:
[Darwin] Amend section for constants with reloactions.

Darwin's linker doesn't like text section relocations (they require special
enabling).  At least, the Fortran FE seems to generate cases where the
initialiser for a pointer constant can need a relocation.  We can handle
this by special-casing SECCAT_RODATA when the relocation is present by
placing the constant in the .const_data section.

gcc/ChangeLog:

2019-10-05  Iain Sandoe  

PR target/59888
* config/darwin.c (darwin_rodata_section): Add relocation flag,
choose const_data section for constants with relocations.
(machopic_select_section): Pass relocation flag to
darwin_rodata_section ().


Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/darwin.c

[Bug c++/91987] -fstrict-eval-order issues

2019-10-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91987

--- Comment #8 from Jakub Jelinek  ---
Another testcase, another reason:
int a[4] = { 1, 2, 3, 4 };
int b[4] = { 5, 6, 7, 8 };

int
foo (void)
{
  int *x = a;
  int r = x[(x = b, 3)];
  if (x != b)
__builtin_abort ();
  return r;
}

int
main ()
{
  if (foo () != 3)
__builtin_abort ();
}

The problem here is that we somewhere fold the x[(x = b, 3)] which with
-fstrong-eval-order should have well defined ordering between x and (x = b, 3)
into
*(x + (x = b, 3)) which is undefined.

[Bug c++/91369] Implement P0784R7: constexpr new

2019-10-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91369

--- Comment #10 from Jakub Jelinek  ---
Author: jakub
Date: Sat Oct  5 07:38:21 2019
New Revision: 276622

URL: https://gcc.gnu.org/viewcvs?rev=276622=gcc=rev
Log:
PR c++/91369 - Implement P0784R7: constexpr new
c-family/
* c-cppbuiltin.c (c_cpp_builtins): Predefine
__cpp_constexpr_dynamic_alloc=201907 for -std=c++2a.
cp/
* cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_UNINIT_IDENTIFIER,
CPTI_HEAP_IDENTIFIER and CPTI_HEAP_DELETED_IDENTIFIER.
(heap_uninit_identifier, heap_identifier, heap_deleted_identifier):
Define.
(type_has_constexpr_destructor, build_new_constexpr_heap_type,
cxx_constant_dtor): Declare.
* class.c (type_maybe_constexpr_default_constructor): Make static.
(type_maybe_constexpr_destructor, type_has_constexpr_destructor): New
functions.
(finalize_literal_type_property): For c++2a, don't clear
CLASSTYPE_LITERAL_P for types without trivial destructors unless they
have non-constexpr destructors.
(explain_non_literal_class): For c++2a, complain about non-constexpr
destructors rather than about non-trivial destructors.
* constexpr.c: Include stor-layout.h.
(struct constexpr_global_ctx): New type.
(struct constexpr_ctx): Add global field, remove values and
constexpr_ops_count.
(cxx_replaceable_global_alloc_fn): New inline function.
(cxx_eval_call_expression): For c++2a allow calls to replaceable
global allocation functions, for new return address of a heap uninit
var, for delete record its deletion.  Change ctx->values->{get,put} to
ctx->global->values.{get,put}.
(non_const_var_error): Add auto_diagnostic_group sentinel.  Emit
special diagnostics for heap variables.
(cxx_eval_store_expression): Change ctx->values->{get,put} to
ctx->global->values.{get,put}.
(cxx_eval_loop_expr): Initialize jump_target if NULL.  Change
new_ctx.values->remove to ctx->global->values.remove.
(cxx_eval_constant_expression): Change *ctx->constexpr_ops_count
to ctx->global->constexpr_ops_count.  Change ctx->values->{get,put} to
ctx->global->values.{get,put}.
: Formatting fix.  On cast of replaceable global
allocation function to some pointer type, adjust the type of
the heap variable and change name from heap_uninit_identifier
to heap_identifier.
(find_heap_var_refs): New function.
(cxx_eval_outermost_constant_expr): Add constexpr_dtor argument,
handle evaluation of constexpr dtors and add tracking of heap
variables.  Use tf_no_cleanup for get_target_expr_with_sfinae.
(cxx_constant_value): Adjust cxx_eval_outermost_constant_expr caller.
(cxx_constant_dtor): New function.
(maybe_constant_value, fold_non_dependent_expr_template,
maybe_constant_init_1): Adjust cxx_eval_outermost_constant_expr
callers.
(potential_constant_expression_1): Ignore clobbers.  Allow
COND_EXPR_IS_VEC_DELETE for c++2a.
* decl.c (initialize_predefined_identifiers): Add heap identifiers.
(decl_maybe_constant_destruction): New function.
(cp_finish_decl): Don't clear TREE_READONLY for constexpr variables
with non-trivial, but constexpr destructors.
(register_dtor_fn): For constexpr variables with constexpr non-trivial
destructors call cxx_maybe_build_cleanup instead of adding destructor
calls at runtime.
(expand_static_init): For constexpr variables with constexpr
non-trivial destructors call cxx_maybe_build_cleanup.
(grokdeclarator): Allow constexpr destructors for c++2a.  Formatting
fix.
(cxx_maybe_build_cleanup): For constexpr variables with constexpr
non-trivial destructors call cxx_constant_dtor instead of adding
destructor calls at runtime.
* init.c: Include stor-layout.h.
(build_new_constexpr_heap_type, maybe_wrap_new_for_constexpr): New
functions.
(build_new_1): For c++2a and new[], add cast around the alloc call
to help constexpr evaluation figure out the type of the heap storage.
(build_vec_delete_1): Set DECL_INITIAL of tbase and emit a DECL_EXPR
for it instead of initializing an uninitialized variable.
* method.c: Include intl.h.
(SFK_CTOR_P, SFK_DTOR_P, SFK_ASSIGN_P, SFK_COPY_P, SFK_MOVE_P): Move
definitions earlier.
(process_subob_fn): Add sfk argument, adjust non-constexpr call
diagnostics based on it.
(walk_field_subobs): Formatting fixes.  Adjust process_subob_fn caller.
(synthesized_method_base_walk): Likewise.
(synthesized_method_walk): Set *constexpr_p to true for dtors in c++2a.
Fix up DR number in comment.
(implicitly_declare_fn): Formatting 

[Bug tree-optimization/91734] gcc skip an if statement with "-O1 -ffast-math"

2019-10-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91734

--- Comment #9 from Jakub Jelinek  ---
Author: jakub
Date: Sat Oct  5 07:36:09 2019
New Revision: 276621

URL: https://gcc.gnu.org/viewcvs?rev=276621=gcc=rev
Log:
PR tree-optimization/91734
* generic-match-head.c: Include fold-const-call.h.
* match.pd (sqrt(x) cmp c): Check the boundary value and
in case inexact computation of c*c affects comparison of the boundary,
turn LT_EXPR into LE_EXPR, GE_EXPR into GT_EXPR, LE_EXPR into LT_EXPR
or GT_EXPR into GE_EXPR.  Punt for sqrt comparisons against NaN and
for -frounding-math.  For c2, try the next smaller or larger floating
point constant depending on comparison code and if it has the same
sqrt as c2, use it instead of c2.

* gcc.dg/pr91734.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/pr91734.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/generic-match-head.c
trunk/gcc/match.pd
trunk/gcc/testsuite/ChangeLog

[Bug ada/91995] gnat miscompilation and bootstrap failure on m68k-linux

2019-10-05 Thread mikpelinux at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91995

Mikael Pettersson  changed:

   What|Removed |Added

  Attachment #46997|0   |1
is obsolete||

--- Comment #2 from Mikael Pettersson  ---
Created attachment 46998
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46998=edit
Workaround, corrected ChangeLog