[Bug bootstrap/84405] [8 Regression] Fails to bootstrap with GCC 4.1.2, GCC 4.2.4

2018-02-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84405

--- Comment #9 from Jakub Jelinek  ---
Author: jakub
Date: Mon Feb 26 14:37:45 2018
New Revision: 257989

URL: https://gcc.gnu.org/viewcvs?rev=257989&root=gcc&view=rev
Log:
PR bootstrap/84405
* vec.h (vec_default_construct): For BROKEN_VALUE_INITIALIZATION use
memset and value initialization afterwards.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/vec.h

[Bug bootstrap/84405] [8 Regression] Fails to bootstrap with GCC 4.1.2, GCC 4.2.4

2018-02-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84405

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #8 from Jakub Jelinek  ---
Worked around (so far for < 4.4 other than 4.2.[0-3]) on the trunk.

[Bug bootstrap/84405] [8 Regression] Fails to bootstrap with GCC 4.1.2, GCC 4.2.4

2018-02-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84405

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Fri Feb 16 09:05:35 2018
New Revision: 257726

URL: https://gcc.gnu.org/viewcvs?rev=257726&root=gcc&view=rev
Log:
PR bootstrap/84405
* system.h (BROKEN_VALUE_INITIALIZATION): Define for GCC < 4.3.
* vec.h (vec_default_construct): Use memset instead of placement new
if BROKEN_VALUE_INITIALIZATION is defined.
* hash-table.h (hash_table::empty_slow): Use
memset instead of value initialization if BROKEN_VALUE_INITIALIZATION
is defined.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/hash-table.h
trunk/gcc/system.h
trunk/gcc/vec.h

[Bug bootstrap/84405] [8 Regression] Fails to bootstrap with GCC 4.1.2, GCC 4.2.4

2018-02-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84405

--- Comment #6 from Jakub Jelinek  ---
Another testcase that could in theory affect vec_default_construct is:
extern "C" void abort ();
typedef __typeof (sizeof (0)) size_t;
inline void *operator new (size_t, void * p) { return p; }
extern "C" void *memset (void *, int, size_t);
template
struct A { T t; U u; };
struct B { B (); ~B (); int b; };
B::B () : b (9) {}
B::~B () {}

template 
void foo (char *p) { new (p) T (); }

int
main ()
{
  int a;
  struct S
  {
A b;
char c[sizeof (A)];
  } s;
  A *p = (A *) &s.c;
  memset (s.c, 0x55, sizeof (s.c));
  foo  > (s.c);
  if (p->t)
abort ();
}

and that was fixed in PR11309 / r138355 only in 4.4.
And Jon mentions another one value initialization related - PR30111.

[Bug bootstrap/84405] [8 Regression] Fails to bootstrap with GCC 4.1.2, GCC 4.2.4

2018-02-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84405

--- Comment #5 from Jakub Jelinek  ---
So, seems it is that hash-table.h change that really doesn't work in GCC
r132088, not just 4.2.*, but any (tried even 3.2).

The implicitly defined default constructor for A (hash_map<...>::hash_entry in
gcc) doesn't initialize the POD t field (which is correct I assume, current
trunk doesn't do that either), but the value initialization before r132088 only
constructs the non-POD u field of A and doesn't initialize t at all (in GCC
that is the m_key, in the stuck case with type edge_def *).

extern "C" void abort ();
template
struct A { T t; U u; };
struct B { B (); ~B (); int b; };
B::B () : b (9) {}
B::~B () {}
template 
void foo (T *p) { *p = T (); }

int
main ()
{
  int a;
  A h;
  h.t = &a;
  foo (&h);
  if (h.t)
abort ();
}

So, either we need to conditionally revert (for say
#if GCC_VERSION != 0 && GCC_VERSION < 4003 && !defined(__clang__)
) the hash-table.h change and use memset.h for old GCCs, or we need some
template hackery to determine if value_type is hash_map::hash_entry
from hash-map.h and instead of using *entries = value_type (); do
entries->m_key = value_type::compare_type ();
entries->m_value = something ();

Ugh.

[Bug bootstrap/84405] [8 Regression] Fails to bootstrap with GCC 4.1.2, GCC 4.2.4

2018-02-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84405

Jakub Jelinek  changed:

   What|Removed |Added

   Priority|P3  |P1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-02-15
 CC||msebor at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #4 from Jakub Jelinek  ---
The first revision that can't be bootstrapped with GCC 3.4.6 is again r249234.
While rejecting GCC 4.2.[0-3] with PR33916 unfixed might be an option, I'm
afraid rejecting everything older than that is not.
I'll try to see what's going on in say 4.1.*.

[Bug bootstrap/84405] [8 Regression] Fails to bootstrap with GCC 4.1.2, GCC 4.2.4

2018-02-15 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84405

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |8.0

[Bug bootstrap/84405] [8 Regression] Fails to bootstrap with GCC 4.1.2, GCC 4.2.4

2018-02-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84405

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
Tried to bisect this, but it doesn't lead anywhere.  r8 fails to compile
it, just because I haven't tried to tweak the 3.4.6 preprocessed *.ii file
enough (e.g. offsetof), r9 through r113198 compile it, but it hangs at
runtime,
r113199 ICEs on it in C++ FE, r113250 ICEs on it in the gimplifier, r113500
errors on it:
../../gcc/poly-int.h:172: error: incomplete type ‘wi::int_traits’ used in nested name specifier
../../gcc/tree-ssa.c: In function ‘void maybe_rewrite_mem_ref_base(tree_node**,
bitmap_head*)’:
../../gcc/tree-ssa.c:1388: error: no match for ‘operator==’ in
‘wi::to_offset(((const tree_node*)tree_class_check(contains_struct_check((*
tp), TS_TYPED, ((const char*)"../../gcc/tree-ssa.c"), 1387, ((const char*)(&
__FUNCTION__)))->tree_node::typed.tree_typed::type, tcc_type, ((const
char*)"../../gcc/tree-ssa.c"), 1387, ((const char*)(&
__FUNCTION__)))->tree_node::type_common.tree_type_common::size)) ==
tree_class_check(contains_struct_check((* tp), TS_TYPED, ((const
char*)"../../gcc/tree-ssa.c"), 1388, ((const char*)(&
__FUNCTION__)))->tree_node::typed.tree_typed::type, tcc_type, ((const
char*)"../../gcc/tree-ssa.c"), 1388, ((const char*)(&
__FUNCTION__)))->tree_node::type_common.tree_type_common::precision’
../../gcc/tree-ssa.c: In function ‘tree_node*
non_rewritable_mem_ref_base(tree_node*)’:
../../gcc/tree-ssa.c:1457: error: no match for ‘operator==’ in
‘wi::to_offset(((const tree_node*)tree_class_check(contains_struct_check(base,
TS_TYPED, ((const char*)"../../gcc/tree-ssa.c"), 1456, ((const char*)(&
__FUNCTION__)))->tree_node::typed.tree_typed::type, tcc_type, ((const
char*)"../../gcc/tree-ssa.c"), 1456, ((const char*)(&
__FUNCTION__)))->tree_node::type_common.tree_type_common::size)) ==
tree_class_check(contains_struct_check(base, TS_TYPED, ((const
char*)"../../gcc/tree-ssa.c"), 1457, ((const char*)(&
__FUNCTION__)))->tree_node::typed.tree_typed::type, tcc_type, ((const
char*)"../../gcc/tree-ssa.c"), 1457, ((const char*)(&
__FUNCTION__)))->tree_node::type_common.tree_type_common::precision’

and so does up to r117833, r117834 is the first one with the bad value
initialization, fixed only in r132088, which is the first one that actually
works.

[Bug bootstrap/84405] [8 Regression] Fails to bootstrap with GCC 4.1.2, GCC 4.2.4

2018-02-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84405

Richard Biener  changed:

   What|Removed |Added

 Target|x86_64-*-*  |x86_64-linux-gnu
  Known to work||4.3.6
  Known to fail||3.4.6, 4.1.2, 4.2.4

--- Comment #2 from Richard Biener  ---
Note 3.4.6 I tested was a compiler for i?86-linux.  The hang is when compiling
the following unreduced configure test from libgcc:

/* confdefs.h */
#define PACKAGE_NAME "GNU C Runtime Library"
#define PACKAGE_TARNAME "libgcc"
#define PACKAGE_VERSION "1.0"
#define PACKAGE_STRING "GNU C Runtime Library 1.0"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL "http://www.gnu.org/software/libgcc/";
/* end confdefs.h.  */
#include 
#include 
#include 
#include 
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
 char **p;
 int i;
{
  return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
  char *s;
  va_list v;
  va_start (v,p);
  s = g (p, va_arg (v,int));
  va_end (v);
  return s;
}

/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
   function prototypes and stuff, but not '\xHH' hex character constants.
   These don't provoke an error unfortunately, instead are silently treated
   as 'x'.  The following induces an error, until -std is added to get
   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
   array size at least.  It's necessary to write '\x00'==0 to get something
   that's true only with -std.  */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];

/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
   inside strings and character constants.  */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];

int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int,
int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
  ;
  return 0;
}

Backtrace is

#0  0x08e48e57 in hash_map,
simple_hashmap_traits, auto_vec > >::hash_entry::equal (a=..., b=@0xfffd4590: 
2)>)
at /tmp/trunk/gcc/hash-map.h:44
#1  0x08e4828c in hash_table,
simple_hashmap_traits, auto_vec > >::hash_entry, xcallocator>::find_with_hash (this=0xb656a40, 
comparable=@0xfffd4590:  2)>, hash=4276329372)
at /tmp/trunk/gcc/hash-table.h:858
#2  0x08e4784f in hash_map,
simple_hashmap_traits, auto_vec > >::get (
this=0xb656a40, k=@0xfffd4590:  2)>)
at /tmp/trunk/gcc/hash-map.h:161
#3  0x08e3caf7 in redirect_edge_var_map_clear (
e= 2)>) at /tmp/trunk/gcc/tree-ssa.c:79
#4  0x08e3cbeb in ssa_redirect_edge (e= 2)>, 
dest=) at /tmp/trunk/gcc/tree-ssa.c:145
#5  0x08be9bf5 in gimple_redirect_edge_and_branch (
e= 2)>, dest=)
at /tmp/trunk/gcc/tree-cfg.c:6163
#6  0x085df140 in redirect_edge_and_branch (e= 2)>, 
dest=) at /tmp/trunk/gcc/cfghooks.c:369
#7  0x08bde392 in gimple_split_edge (edge_in= 2)>)
at /tmp/trunk/gcc/tree-cfg.c:2969
#8  0x085dfab1 in split_edge (e= 2)>)
at /tmp/trunk/gcc/cfghooks.c:648
#9  0x08c46208 in tree_function_versioning (old_decl=
, 
new_decl=, 
tree_map=0xf7244420 = {...}, update_clones=true, args_to_skip=0x0, 
skip_return=false, blocks_to_copy=0x0, new_entry=)
at /tmp/trunk/gcc/tree-inline.c:6055
#10 0x08621d7d in cgraph_materialize_clone (
node=)
at /tmp/trunk/gcc/cgraphclones.c:1024
#11 0x08622194 in symbol_table::materialize_all_clones (this=0xf71020c8)
at /tmp/trunk/gcc/cgraphclones.c:1125
#12 0x0891eacb in (anonymous namespace)::pass_materialize_all_clones::execute (
this=0xb5f47f8) at /tmp/trunk/gcc/ipa.c:1429
#13 0x08a6f3a7 in execute_one_pass (
pass=)
at /tmp/trunk/gcc/passes.c:2497
#14 0x08a70419 in execute_ipa_pass_list (
pass=)
at /tmp/trunk/gcc/passes.c:2932
#15 0x0861d030 in symbol_table::compile (this=0xf71020c8)
at /tmp/trunk/gcc/cgraphunit.c:2589
#16 0x0861d25f in symbol_table::finalize_compilation_unit (this=0xf71020c8)
at /tmp/trunk/gcc/cgraphunit.c:2717
#17 0x08b90f17 in compile_file () at /tmp/trunk/gcc/toplev.c:480
#18 0x08b936ce in do_compile () at /tmp/trunk/gcc/toplev.c:2097
#19 0x08b93a28 in toplev::main (this=0xfffd4ab0, argc=24, argv=0xfffd4b64)
at /tmp/trunk/gcc/toplev.c:2232
#20 0x097f0e21 in main (argc=24, argv=0xfffd4b64) at /tmp/trunk/gcc/main.c:39

and it doesn't finish frame #1

[Bug bootstrap/84405] [8 Regression] Fails to bootstrap with GCC 4.1.2, GCC 4.2.4

2018-02-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84405

Richard Biener  changed:

   What|Removed |Added

 Blocks||82939

--- Comment #1 from Richard Biener  ---
There's a related bootstrap failure with GCC 4.2.{0,1,2,3} which has been
tracked down.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82939
[Bug 82939] genmatch fills up terminal with endless printing of periods