[Bug c++/17053] [3.5 Regression] Repo functionality partially broken on AIX

mark at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Tue Aug 17 15:49:00 GMT 2004


------- Additional Comments From mark at codesourcery dot com  2004-08-17 15:49 -------
Subject: Re:  [3.5 Regression] Repo functionality partially
 broken on AIX

dje at gcc dot gnu dot org wrote:

>------- Additional Comments From dje at gcc dot gnu dot org  2004-08-17 15:08 -------
>Note that the divergence occurs with -frepo before the repo file has been 
>updated with information about which templates should be instantiated and 
>recompiled.
>  
>
Right, I understand.  With the "-frepo" switch on the first compilation, 
G++ will avoid instantiating the template, and therefore will not learn 
that it cannot throw.  Without the "-frepo" switch, it will have to 
instantiate the template, will therefore learn that it cannot throw.

>AIX performs constructor discovery first because the garbage collecting linker 
>may find no references to static constructors before the scan, which will cause 
>it not to link in the static constructors, leaving nothing for the scan to find.
>
I understand.

There might have been bugs in this area before; for example, I'd expect:

  int f();

  template <typename T>
  struct S {
    static int i;
  };

 template <typename T>
 int S<T>::i = f();
 
 int main () { return S<int>::i; }

to result in a global constructor call without -frepo, but not with 
-frepo, and therefore have the same problem.  However, it may be that 
the lack of weak symbols means that without -frepo the compiler delays 
instantiation of S<int>::i, and that we therefore skirt this particular 
problem.

In any case, I don't think there's really any way to get NOTHROW set 
correctly 100% of the time unless we actually generate code (all the way 
through the optimizers) for every template that might be instantiated.  
So, I think this problem needs to be addressed in some other way.

I think that that the best thing would be to make the constructor 
discovery process iterative in the case of AIX.  After each cycle of 
recompilation, we need to regenerate the list.  If you agree, I will try 
to write the code, but I don't have an AIX system, so you might have to 
do the testing.

Thanks,



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17053



More information about the Gcc-bugs mailing list