[Bug c++/60894] New: Use of redundant struct keyword in virtual function prototype combined with using statement causes compilation error

2014-04-19 Thread loose at astron dot nl
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60894

Bug ID: 60894
   Summary: Use of redundant struct keyword in virtual function
prototype combined with using statement causes
compilation error
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: loose at astron dot nl

The code below causes a compilation error:
t.cc:15:6: error: prototype for ‘void D::doIt(B::S&)’ does not match any in
class ‘D’

class B
{
protected:
  struct S {};
  virtual void doIt(struct S& s) = 0;
};

class D : public B
{
public:
  using B::S;
  virtual void doIt(struct S& s);
};

void D::doIt(struct S& s)
{
  (void)s;
}

This code compiles fine if I remove the redundant struct keyword in the virtual
function prototype. It also compiles fine if I remove the using declaration. It
seems as if the compiler thinks I'm forward declaring another struct S inside
the declaration of D::doIt().

[Bug tree-optimization/60895] New: error: address taken, but ADDRESSABLE bit not set

2014-04-19 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60895

Bug ID: 60895
   Summary: error: address taken, but ADDRESSABLE bit not set
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: glisse at gcc dot gnu.org

Compiling with g++ grr.ii -c -O

struct C {
  double elems[3];
};
C fn1() {
  double *f;
  C a;
  f = a.elems;
  for (int b; b;) {
*f = 0;
++f;
  }
  return a;
}

struct J {
  C c;
  J() : c(fn1()) {}
};
void fn2() { J(); }


grr.ii: In function 'void fn2()':
grr.ii:19:6: error: address taken, but ADDRESSABLE bit not set
 void fn2() { J(); }
  ^
PHI argument
&D.2276.c.elems;
for PHI node
f_4 = PHI <&D.2276.c.elems(2), f_5(3)>
grr.ii:19:6: internal compiler error: verify_ssa failed
0xf92ebf verify_ssa(bool)
/data/repos/gcc/trunk/gcc/tree-ssa.c:1096
0xc97869 execute_function_todo
/data/repos/gcc/trunk/gcc/passes.c:1784
0xc96b38 do_per_function
/data/repos/gcc/trunk/gcc/passes.c:1504
0xc97983 execute_todo
/data/repos/gcc/trunk/gcc/passes.c:1817
0xc97eb1 execute_one_ipa_transform_pass
/data/repos/gcc/trunk/gcc/passes.c:2006
0xc97fb0 execute_all_ipa_transforms()
/data/repos/gcc/trunk/gcc/passes.c:2037
0x96eae1 expand_function
/data/repos/gcc/trunk/gcc/cgraphunit.c:1767
0x96f0fe expand_all_functions
/data/repos/gcc/trunk/gcc/cgraphunit.c:1908
0x96faca compile()
/data/repos/gcc/trunk/gcc/cgraphunit.c:2252
0x96fc43 finalize_compilation_unit()
/data/repos/gcc/trunk/gcc/cgraphunit.c:2329
0x6f2294 cp_write_global_declarations()
/data/repos/gcc/trunk/gcc/cp/decl2.c:4619

This compiles with gcc-4.8. It is reduced from a real program that does not
have uninitialized variables.


[Bug tree-optimization/60896] New: [4.10 Regression] ICE: in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1449

2014-04-19 Thread trippels at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60896

Bug ID: 60896
   Summary: [4.10 Regression] ICE: in
vect_get_vec_def_for_operand, at
tree-vect-stmts.c:1449
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: trippels at gcc dot gnu.org

markus@x4 skia % cat test.ii
struct A
{
  int m_fn1 ();
  short *m_fn2 ();
};
struct B
{
  void *fC;
};
int a, b;
unsigned char i;
void fn1 (unsigned char *p1, A &p2)
{
  int c = p2.m_fn1 ();
  for (int d = 0; c; d++)
{
  short *e = p2.m_fn2 ();
  unsigned char *f = &p1[0];
  for (int g = 0; g < a; g++)
{
  int h = e[0];
  b += h * f[g];
}
}
}

void fn2 (A &p1, A &p2, B &p3)
{
  int j = p2.m_fn1 ();
  for (int k = 0; j; k++)
if (0)
  ;
else
  fn1 (&i, p1);
  if (p3.fC)
;
  else
;
}

markus@x4 skia % g++ -c -O3 test.ii
test.ii: In function ‘void fn2(A&, A&, B&)’:
test.ii:27:6: internal compiler error: in vect_get_vec_def_for_operand, at
tree-vect-stmts.c:1449
 void fn2 (A &p1, A &p2, B &p3)
  ^
Please submit a full bug report,

[Bug gcov-profile/60897] New: Mangled function name in warning during -fprofile-use phase of Firefox build

2014-04-19 Thread trippels at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60897

Bug ID: 60897
   Summary: Mangled function name in warning during -fprofile-use
phase of Firefox build
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: gcov-profile
  Assignee: unassigned at gcc dot gnu.org
  Reporter: trippels at gcc dot gnu.org

During Firefox PGO build I noticed an mangled function name 
in a warning during -fprofile-use phase:

markus@x4 src % c++ -o Unified_cpp_js_src2.o -c  -I../../dist/system_wrappers
-include /var/tmp/mozilla-central/config/gcc_hidden.h -DENABLE_PARALLEL_JS
-DENABLE_BINARYDATA -DENABLE_SHARED_ARRAY_BUFFER -DEXPORT_JS_API
-DJS_HAS_CTYPES -DDLL_PREFIX='"lib"' -DDLL_SUFFIX='".so"' -DUSE_SYSTEM_MALLOC=1
-DENABLE_ASSEMBLER=1 -DENABLE_JIT=1 -DMOZ_GLUE_IN_PROGRAM -DNO_NSPR_10_SUPPORT
-DUSE_ZLIB -I/var/tmp/mozilla-central/js/src -I.
-I/usr/lib64/libffi-3.0.13/include 
-I/var/tmp/mozilla-central/js/src/../../mfbt/double-conversion 
-I../../dist/include  -I/usr/include/nspr-fPIC   -DMOZILLA_CLIENT
-include ../../js/src/js-confdefs.h -MD -MP -MF .deps/Unified_cpp_js_src2.o.pp 
-Wall -Wpointer-arith -Woverloaded-virtual -Werror=return-type
-Werror=int-to-pointer-cast -Wtype-limits -Wempty-body -Werror=conversion-null
-Wsign-compare -Wno-invalid-offsetof -Wcast-align -fprofile-use
-fprofile-correction -ffunction-sections -fdata-sections -march=amdfam10
-fno-rtti -fno-exceptions -fno-math-errno -std=gnu++0x -pthread -pipe  -DNDEBUG
-DTRIMMED -O3 -fomit-frame-pointer
/var/tmp/moz-build-dir/js/src/Unified_cpp_js_src2.cpp
In file included from
/var/tmp/moz-build-dir/js/src/Unified_cpp_js_src2.cpp:106:0:
/var/tmp/mozilla-central/js/src/jit/BaselineIC.cpp: In function ‘bool
js::jit::_ZN2js3jitL26TryAttachNativeGetPropStubEP9JSContextN2JS6HandleIP8JSScriptEEPhPNS0_18ICGetProp_FallbackENS4_IPNS_12PropertyNameEEENS4_INS3_5ValueEEESF_Pb.isra.1329(JSContext*,
JS::HandleScript, jsbytecode*, js::jit::ICGetProp_Fallback*,
js::HandlePropertyName, JS::HandleValue, bool*)’:
/var/tmp/mozilla-central/js/src/jit/BaselineIC.cpp:6215:13: warning:
‘domProxyHasGeneration’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
 if (domProxyHasGeneration) {
 ^
/var/tmp/mozilla-central/js/src/jit/BaselineIC.cpp:6245:20: warning:
‘domProxyShadowsResult’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
 if (isDOMProxy && domProxyShadowsResult == Shadows) {
^

markus@x4 src % c++filt
_ZN2js3jitL26TryAttachNativeGetPropStubEP9JSContextN2JS6HandleIP8JSScriptEEPhPNS0_18ICGetProp_FallbackENS4_IPNS_12PropertyNameEEENS4_INS3_5ValueEEESF_Pb.isra.1329
js::jit::TryAttachNativeGetPropStub(JSContext*, JS::Handle, unsigned
char*, js::jit::ICGetProp_Fallback*, JS::Handle,
JS::Handle, JS::Handle, bool*) [clone .isra.1329]

[Bug gcov-profile/60897] Mangled function name in warning during -fprofile-use phase of Firefox build

2014-04-19 Thread trippels at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60897

Markus Trippelsdorf  changed:

   What|Removed |Added

   Target Milestone|--- |4.9.1


[Bug fortran/60898] New: model compile error with gfortran 4.7 and gcc 4.9 on Mac OS 10.9

2014-04-19 Thread shaojuncycle at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60898

Bug ID: 60898
   Summary: model compile error with gfortran 4.7 and gcc 4.9 on
Mac OS 10.9
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: shaojuncycle at gmail dot com

mpif90 -ffree-form  -O3  -fno-second-underscore -fno-range-check -I
/home/model/comGSI_v3.2/include -I /usr/local/netcdf/include  -DLINUX -DMACOS
-DPGI -c plib8b.f90 
plib8b.f90:1902:0: internal compiler error: Segmentation fault: 11^M
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
make[2]: [plib8b.o] Error 1 (ignored)

..

Here is the error information, I have tried it with gfortran 4.8, and got the
same result. Could anyone let me know what is the problem about it? The entire
log file is in the attachment. 
Any advise will be appreciate. Thank you so much.


[Bug tree-optimization/60899] New: undef reference generated with -fdevirtualize-speculatively

2014-04-19 Thread xinliangli at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60899

Bug ID: 60899
   Summary: undef reference generated with
-fdevirtualize-speculatively
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: xinliangli at gmail dot com

Build the following code with the following command line:

g++ -O2 -fdisable-tree-einline a.cc a_m.cc 

results in:

/tmp/cci31j3N.o: In function `D::doit()':
a.cc:(.text._ZN1D4doitEv[_ZN1D4doitEv]+0x5): undefined reference to `A::foo()'
collect2: error: ld returned 1 exit status

It builds fine when devirtualization is disabled:

-O2 -fno-devirtualization-speculatively -fdisable-tree-einline 


The problem is there is no instantiation of any class A instances (final or
subclass) in the program, so vtables and A::foo are all eliminated. The
reference to A::foo is from D::doit. In a successful build, there are no D
instances either, so D::doit won't be emitted. However with speculative
devirtualization, D::doit may be speculatively referenced even though there are
no D instances.

What happens is that during ipa-inline, goo is inlined into D::doit, the
virtual call to foo should become an direct call to A::foo, but the new edge is
not discovered. Since there is no call edge to A::foo, A::foo gets removed
right after ipa-inline (before inline transform). However during inline
transform, gimple-fold-call converts the virtual call into a direct call.


The test case is extracted from a very large real program. The explicit
reference to D::doit in bar is to demonstrate the problem -- in the real
program, the reference is from spec-devirt.


//a.h
struct B {
 virtual int foo() = 0;
 int goo() { return foo(); }
 int i;
};

struct A  : public B {
 A() : i(0)  {}
 int foo() { return 1;}
 int i;
};
struct A2  : public B {
 int foo() { return 2;}
};

struct DI {
  virtual int doit() = 0;
};

struct D : public DI {
   virtual int doit () { return m.goo(); }

   A m;
};

// a.cc

#include "a.h"

int cond;
int bar (DI* ap) {
   if (cond) return static_cast(ap)->D::doit();  // Mimic speculative
devirtualization
   return ap->doit();
}


// a_m.cc

#include "a.h"

int cond;
int bar (DI* ap) {
   if (cond) return static_cast(ap)->D::doit();  // Mimic speculative
devirtualization
   return ap->doit();
}


[Bug tree-optimization/60899] undef reference generated with -fdevirtualize-speculatively

2014-04-19 Thread hubicka at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60899

Jan Hubicka  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |hubicka at gcc dot 
gnu.org

--- Comment #1 from Jan Hubicka  ---
David,
can you check if can_refer_decl_in_current_unit_p


[Bug tree-optimization/60899] undef reference generated with -fdevirtualize-speculatively

2014-04-19 Thread hubicka at ucw dot cz
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60899

--- Comment #2 from Jan Hubicka  ---
David,
it seems a_m.C should be different form a.C.  From chain of events you describe
I think
we need to figure out why the last folding happens.  Does the function pass 
can_refer_decl_in_current_unit_p and if so, how does cgraph node look at that
time?

Honza


[Bug tree-optimization/60899] undef reference generated with -fdevirtualize-speculatively

2014-04-19 Thread xinliangli at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60899

--- Comment #3 from davidxl  ---
(In reply to Jan Hubicka from comment #2)
> David,
> it seems a_m.C should be different form a.C.  From chain of events you
> describe I think
> we need to figure out why the last folding happens.  Does the function pass 
> can_refer_decl_in_current_unit_p and if so, how does cgraph node look at
> that time?
> 
> Honza

Cut & paste error:

// a_m.cc

#include "a.h"
struct D2: public DI {
  virtual int doit () { return 3; }
};

extern int bar(DI*);
int main()
{
  D2 d2;
  return bar(&d2);
}