[Bug c++/90947] [9 Regression] Simple lookup table of array of strings is miscompiled

2020-02-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90947

Jakub Jelinek  changed:

   What|Removed |Added

 CC||rodrigorivascosta at gmail dot 
com

--- Comment #16 from Jakub Jelinek  ---
*** Bug 93630 has been marked as a duplicate of this bug. ***

[Bug c++/90947] [9 Regression] Simple lookup table of array of strings is miscompiled

2019-11-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90947

--- Comment #15 from Jakub Jelinek  ---
Author: jakub
Date: Fri Nov  8 18:56:42 2019
New Revision: 277985

URL: https://gcc.gnu.org/viewcvs?rev=277985=gcc=rev
Log:
Backported from mainline
2019-10-31  Jakub Jelinek  

PR c++/90947
* tree.h (type_initializer_zero_p): Remove.
* tree.c (type_initializer_zero_p): Remove.

* cp-tree.h (type_initializer_zero_p): Declare.
* decl.c (reshape_init_array_1): Formatting fix.
* tree.c (type_initializer_zero_p): New function.  Moved from
../tree.c, use next_initializable_field, formatting fix.  Return
false for TYPE_NON_AGGREGATE_CLASS types.

Added:
branches/gcc-9-branch/gcc/testsuite/g++.dg/init/array54.C
Modified:
branches/gcc-9-branch/gcc/ChangeLog
branches/gcc-9-branch/gcc/cp/ChangeLog
branches/gcc-9-branch/gcc/cp/cp-tree.h
branches/gcc-9-branch/gcc/cp/decl.c
branches/gcc-9-branch/gcc/cp/tree.c
branches/gcc-9-branch/gcc/tree.c
branches/gcc-9-branch/gcc/tree.h

[Bug c++/90947] [9 Regression] Simple lookup table of array of strings is miscompiled

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

--- Comment #14 from Jakub Jelinek  ---
Author: jakub
Date: Thu Oct 31 07:10:57 2019
New Revision: 277656

URL: https://gcc.gnu.org/viewcvs?rev=277656=gcc=rev
Log:
PR c++/90947
* tree.h (type_initializer_zero_p): Remove.
* tree.c (type_initializer_zero_p): Remove.
cp/
* cp-tree.h (type_initializer_zero_p): Declare.
* decl.c (reshape_init_array_1): Formatting fix.
* tree.c (type_initializer_zero_p): New function.  Moved from
../tree.c, use next_initializable_field, formatting fix.  Return
false for TYPE_NON_AGGREGATE_CLASS types.

Added:
trunk/gcc/testsuite/g++.dg/init/array54.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/decl.c
trunk/gcc/cp/tree.c
trunk/gcc/tree.c
trunk/gcc/tree.h

[Bug c++/90947] [9 Regression] Simple lookup table of array of strings is miscompiled

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

--- Comment #13 from Jakub Jelinek  ---
Created attachment 47082
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47082=edit
gcc10-pr90947.patch

Here is an untested patch that fixes it for -std=c++17/-std=c++2a, though not
for C++11/14, next_initialized_field (TYPE_FIELDS (type)) for std::atomic
is NULL in those cases, as that class contains no non-static data members
directly, just has __atomic_base as a base class.  The initializer has init
list
type in both cases, dunno if we don't need to treat those specially or how else
to fix C++11/14.

[Bug c++/90947] [9 Regression] Simple lookup table of array of strings is miscompiled

2019-10-22 Thread dimitar.yordanov at sap dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90947

Dimitar Yordanov  changed:

   What|Removed |Added

 CC||dimitar.yordanov at sap dot com

--- Comment #12 from Dimitar Yordanov  ---
Hi,

after the fix we hit a regression with:

$ cat > main.cpp << EOF

#include 

static std::atomic a[1] { {1} };

int main(void)
{
  if (!a[0].load())
__builtin_abort ();
  return 0;
}

EOF

$ g++ main.cpp && ./a.out

Best wishes
Dimitar

[Bug c++/90947] [9 Regression] Simple lookup table of array of strings is miscompiled

2019-08-14 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90947

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 CC||jason at gcc dot gnu.org
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org

--- Comment #11 from Jason Merrill  ---
Fixed for 9.3.

[Bug c++/90947] [9 Regression] Simple lookup table of array of strings is miscompiled

2019-08-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90947

--- Comment #10 from Martin Sebor  ---
Author: msebor
Date: Wed Aug 14 20:36:46 2019
New Revision: 274494

URL: https://gcc.gnu.org/viewcvs?rev=274494=gcc=rev
Log:
Backport from mainline

2019-08-01  Martin Sebor  

PR c++/90947
* tree.c (type_initializer_zero_p): Define.
* tree.h (type_initializer_zero_p): New function.

2019-08-05  Martin Sebor  

* doc/extend.texi (Common Variable Attributes): Document alias
attribute.

2019-08-01  Martin Sebor  

PR c++/90947
* decl.c (reshape_init_array_1): Avoid truncating initializer
lists containing string literals.

2019-08-14  Martin Sebor  

PR tree-optimization/91294
* gcc.dg/strlenopt-44.c: Adjust tested result.
* gcc.dg/strlenopt-70.c: Avoid exercising unimplemnted optimization.
* gcc.dg/strlenopt-73.c: New test.
* gcc.dg/strlenopt-74.c: New test.
* gcc.dg/strlenopt-75.c: New test.
* gcc.dg/strlenopt-76.c: New test.
* gcc.dg/strlenopt-77.c: New test.

Added:
branches/gcc-9-branch/gcc/testsuite/c-c++-common/array-1.c
branches/gcc-9-branch/gcc/testsuite/g++.dg/abi/mangle73.C
branches/gcc-9-branch/gcc/testsuite/g++.dg/cpp2a/nontype-class23.C
branches/gcc-9-branch/gcc/testsuite/g++.dg/init/array53.C
Modified:
branches/gcc-9-branch/gcc/ChangeLog
branches/gcc-9-branch/gcc/cp/ChangeLog
branches/gcc-9-branch/gcc/cp/decl.c
branches/gcc-9-branch/gcc/doc/extend.texi
branches/gcc-9-branch/gcc/testsuite/ChangeLog
branches/gcc-9-branch/gcc/tree.c
branches/gcc-9-branch/gcc/tree.h

[Bug c++/90947] [9 Regression] Simple lookup table of array of strings is miscompiled

2019-08-12 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90947

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|9.2 |9.3

--- Comment #9 from Jakub Jelinek  ---
GCC 9.2 has been released.

[Bug c++/90947] [9 Regression] Simple lookup table of array of strings is miscompiled

2019-08-02 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90947

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #8 from Jakub Jelinek  ---
The cp/decl.c change looks weird, it is more readable to use one if with ||
instead of if (cond1) something; else if (cond2) something; where something is
the same in between.

[Bug c++/90947] [9 Regression] Simple lookup table of array of strings is miscompiled

2019-08-02 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90947

Richard Biener  changed:

   What|Removed |Added

  Known to work||10.0

--- Comment #7 from Richard Biener  ---
Please consider backporting for GCC 9.2.

[Bug c++/90947] [9 Regression] Simple lookup table of array of strings is miscompiled

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

Martin Sebor  changed:

   What|Removed |Added

Summary|[9/10 Regression] Simple|[9 Regression] Simple
   |lookup table of array of|lookup table of array of
   |strings is miscompiled  |strings is miscompiled

--- Comment #6 from Martin Sebor  ---
Fixed for GCC 10 in r273989.