Hi people!

I found this compilation problem while building today's trunk with GCC
4.4.7 [1] in a RHEL 6.9 derivative in sparc64:

g++ -fno-PIE -c   -g  -DIN_GCC     -fno-exceptions -fno-rtti 
-fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wno-format 
-Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long 
-Wno-variadic-macros -Wno-overlength-strings -fno-common -Wno-unused 
-DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include 
-I../../gcc/../libcpp/include -I/home/jemarch/couts3/gcc/build/./gmp 
-I/home/jemarch/couts3/gcc/gmp -I/home/jemarch/couts3/gcc/build/./mpfr/src 
-I/home/jemarch/couts3/gcc/mpfr/src -I/home/jemarch/couts3/gcc/mpc/src  
-I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/dpd -I../libdecnumber 
-I../../gcc/../libbacktrace -I/home/jemarch/couts3/gcc/build/./isl/include 
-I/home/jemarch/couts3/gcc/isl/include  -o gimple-match.o -MT gimple-match.o 
-MMD -MP -MF ./.deps/gimple-match.TPo gimple-match.c
In file included from ../../gcc/backend.h:33,
                 from ../../gcc/gimple-match-head.c:23,
                 from gimple-match.c:4:
../../gcc/cfg.h: In constructor ‘auto_edge_flag::auto_edge_flag(function*)’:
../../gcc/cfg.h:172: error: class ‘auto_edge_flag’ does not have any field 
named ‘auto_flag’
../../gcc/cfg.h:172: error: no matching function for call to 
‘auto_flag<int>::auto_flag()’
../../gcc/cfg.h:137: note: candidates are: auto_flag<T>::auto_flag(T*) [with T 
= int]
../../gcc/cfg.h:134: note:                 auto_flag<int>::auto_flag(const 
auto_flag<int>&)
../../gcc/cfg.h: In constructor ‘auto_bb_flag::auto_bb_flag(function*)’:
../../gcc/cfg.h:181: error: class ‘auto_bb_flag’ does not have any field named 
‘auto_flag’
../../gcc/cfg.h:181: error: no matching function for call to 
‘auto_flag<int>::auto_flag()’
../../gcc/cfg.h:137: note: candidates are: auto_flag<T>::auto_flag(T*) [with T 
= int]
../../gcc/cfg.h:134: note:                 auto_flag<int>::auto_flag(const 
auto_flag<int>&)


I reckon the code in question (the definition of the classes
auto_edge_class and auto_bb_flag) is perfectly valid C++, and indeed GCC
6.3.0 compiles it with no problem.

However, I used the following local modification to workaround the
problem:

diff --git a/gcc/cfg.h b/gcc/cfg.h
index 9fff135..3d660bd 100644
--- a/gcc/cfg.h
+++ b/gcc/cfg.h
@@ -169,7 +169,7 @@ class auto_edge_flag : public auto_flag<int>
 {
 public:
   auto_edge_flag (function *fun)
-    : auto_flag (&fun->cfg->edge_flags_allocated) {}
+    : auto_flag<int> (&fun->cfg->edge_flags_allocated) {}
 };
 
 /* RAII class to allocate a bb flag for temporary use.  You have
@@ -178,7 +178,7 @@ class auto_bb_flag : public auto_flag<int>
 {
 public:
   auto_bb_flag (function *fun)
-    : auto_flag (&fun->cfg->bb_flags_allocated) {}
+    : auto_flag<int> (&fun->cfg->bb_flags_allocated) {}
 };
 
 #endif /* GCC_CFG_H */


Considering that 4.4.7 is the default compiler in RHEL 6.x, you may be
interested in installing a similar workaround, or a better one.

Hence this email :)
Salud!

[1] gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18.0.4)

Reply via email to