[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #14 from Jakub Jelinek  ---
Fixed.

[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

--- Comment #13 from Jakub Jelinek  ---
Author: jakub
Date: Thu Apr 20 09:18:02 2017
New Revision: 247014

URL: https://gcc.gnu.org/viewcvs?rev=247014&root=gcc&view=rev
Log:
PR middle-end/80423
* tree.h (build_array_type): Add typeless_storage default argument.
* tree.c (type_cache_hasher::equal): Also compare
TYPE_TYPELESS_STORAGE flag for ARRAY_TYPEs.
(build_array_type): Add typeless_storage argument, set
TYPE_TYPELESS_STORAGE to it, if shared also hash it, and pass to
recursive call.
(build_nonshared_array_type): Adjust build_array_type_1 caller.
(build_array_type): Likewise.  Add typeless_storage argument.
c-family/
* c-common.c (complete_array_type): Preserve TYPE_TYPELESS_STORAGE.
cp/
* tree.c (build_cplus_array_type): Call build_array_type
with the intended TYPE_TYPELESS_STORAGE flag value, instead
of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE
on the shared type.
testsuite/
* g++.dg/other/pr80423.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/other/pr80423.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/tree.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree.c
trunk/gcc/tree.h

[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

Jakub Jelinek  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

Jakub Jelinek  changed:

   What|Removed |Added

  Attachment #41215|0   |1
is obsolete||

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

Updated patch (still untested).

[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-18 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

--- Comment #11 from Markus Trippelsdorf  ---
With the proposed patch:

trippels@gcc2-power8 llvm_build % cat ClangOffloadBundler.ii
typedef unsigned char uint8_t;
struct A {
  template  A(unsigned char (&)[N]);
};
void fn1(A) {
  uint8_t a[]{0};
  fn1(a);
}

trippels@gcc2-power8 llvm_build % /home/trippels/gcc_test/usr/local/bin/g++ -c
ClangOffloadBundler.ii
ClangOffloadBundler.ii: In function ‘void fn1(A)’:
ClangOffloadBundler.ii:7:8: internal compiler error: canonical types differ for
identical types unsigned char [1] and uint8_t [1] {aka unsigned char [1]}
   fn1(a);
^
0x1038d76b comptypes(tree_node*, tree_node*, int)
../../gcc/gcc/cp/typeck.c:1433
0x10191a53 reference_related_p(tree_node*, tree_node*)
../../gcc/gcc/cp/call.c:1442
0x101a68b3 reference_binding
../../gcc/gcc/cp/call.c:1595
0x101a793b implicit_conversion
../../gcc/gcc/cp/call.c:1837
0x101a9c5b add_function_candidate
../../gcc/gcc/cp/call.c:2196
0x101ab0c7 add_template_candidate_real
../../gcc/gcc/cp/call.c:3208
0x101abc57 add_template_candidate
../../gcc/gcc/cp/call.c:3252
0x101abc57 add_candidates
../../gcc/gcc/cp/call.c:5483
0x101a5933 build_user_type_conversion_1
../../gcc/gcc/cp/call.c:3799
0x101a7853 implicit_conversion
../../gcc/gcc/cp/call.c:1898
0x101a9c5b add_function_candidate
../../gcc/gcc/cp/call.c:2196
0x101aba8f add_candidates
../../gcc/gcc/cp/call.c:5496
0x101ac593 perform_overload_resolution
../../gcc/gcc/cp/call.c:4143
0x101afef3 build_new_function_call(tree_node*, vec**, bool, int)
../../gcc/gcc/cp/call.c:4232
0x103fd9f3 finish_call_expr(tree_node*, vec**,
bool, bool, int)
../../gcc/gcc/cp/semantics.c:2441
0x10348197 cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:6992
0x10348f9f cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:8103
0x1034a613 cp_parser_cast_expression
../../gcc/gcc/cp/parser.c:8781
0x1034af87 cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:8882
0x1034bab7 cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:9169

[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

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

Untested fix.

[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

--- Comment #9 from Jakub Jelinek  ---
I think the bug is in:
  t = build_array_type (elt_type, index_type);
  if (elt_type == unsigned_char_type_node
  || elt_type == signed_char_type_node
  || elt_type == char_type_node
  || (TREE_CODE (elt_type) == ENUMERAL_TYPE
  && TYPE_CONTEXT (elt_type) == std_node
  && !strcmp ("byte", TYPE_NAME_STRING (elt_type
TYPE_TYPELESS_STORAGE (t) = 1;
We modify a flag on a cached shared type.  Now, as the flag is controlled
solely by the element type, if all the build_array_type{,_nelts} calls were
done only through this routine, it would just be set everywhere and not a
problem.
But that is not the case, the middle-end etc. also build array types and don't
set the typeless storage flag on it anywhere.
So, either the above needs to be a langhook and we'd need to force that flag on
every array building (but then we need to handle it somehow with LTO too),
or we must not share array types with/without the TYPE_TYPELESS_STORAGE flag.
I'll try to write an untested patch for the latter.

[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-18 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

--- Comment #8 from Markus Trippelsdorf  ---
Created attachment 41212
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41212&action=edit
somewhat reduced testcase

[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-18 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

--- Comment #7 from Markus Trippelsdorf  ---
(In reply to Jakub Jelinek from comment #6)
> Unfortunately can't reproduce, neither with a cross, nor on
> powerpc64le-linux configured with ../configure
> --enable-languages=c,c++,fortran .
> Can this be reproduced on some GCCFarm box somewhere?

Yes, on gcc112:

trippels@gcc2-power8 ~ % /home/trippels/gcc_test/usr/local/bin/g++
-fcompare-debug --param ggc-min-expand=20 --param ggc-min-heapsize=0 -c -O3
SampleProfReader.ii -w

[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek  ---
Unfortunately can't reproduce, neither with a cross, nor on powerpc64le-linux
configured with ../configure --enable-languages=c,c++,fortran .
Can this be reproduced on some GCCFarm box somewhere?

[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-14 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||law at redhat dot com
   Target Milestone|--- |7.0

[Bug middle-end/80423] [7 Regression] GC related -fcompare-debug failure

2017-04-14 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80423

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-04-14
  Component|debug   |middle-end
 Ever confirmed|0   |1

--- Comment #5 from Markus Trippelsdorf  ---
Started with r246866, aka PR79671 fix.