freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Explicit Instantiation Problem with Pooma 2 using KCC on RH 6.2 Linux


From: Dave Nystrom
Subject: Explicit Instantiation Problem with Pooma 2 using KCC on RH 6.2 Linux
Date: Wed, 2 May 2001 18:24:32 -0600 (MDT)

Below is a file, X.cc, which I am unable to compile with KCC on a RH 6.2
Linux machine.  Below that is the build log with the KCC error message that I 
receive when I try to compile it.  The template which I am trying to
explicitly instantiate is one that is referenced by our Pooma 2 application
code and the KCC prelinker is able to instantiate it just fine.  I have been
able to determine which translation unit that the KCC prelinker chooses to
instantiate this template in and have also tried to perform the explicit
instantation in that same translation unit so that I could be sure that
everything that KCC needed to see to perform the instantiation was in fact
included and I get the same error message which I have included below.  I
made a -E output file of the translation unit in question and sent it off to
Arch to look at.  Arch looked at it and made a simpler test case which he
sent off to EDG.  The conclusion of Arch and EDG was that Pooma 2 has a
problem which makes it susceptible to the point of instantiation of a
template.  Below is the reply from Arch and EDG.  Also below is a copy of the 
test problem which Arch sent off to EDG which he felt was an accurate and
simplifed version of the problem I was seeing.

So, why do I care about this.  Because I am trying to build a Pooma 2
template instantiation library specific to our new Pooma 2 application code
so that I can speed up the compiles of developers working on our stuff.  I
did this with our Pooma 1 application in the secure a few months back and got 
alot of mileage out of it.  It is not really difficult modulo these sorts of
problems.  In our current Pooma 2 application source code base the prelinker
instantiates 1800-2000 of these View1<Field<T1,T2,T3>,T4>::sv templates with
different template parameters.  Using xemacs and a keyboard macro, I can
write instantiation requests for all 1800-2000 of them in about 15 minutes.
With a little more sophistication, we could write a Perl tool that would make 
it even easier.  This approach requires periodic maintenance but is not
difficult especially if we took the time to write some Perl tools.  And it
pushes the compilation of Pooma 2 only templates down to the level of Pooma
2.  That means that we only have to build the Pooma 2 instantiations library
when we change/update Pooma 2 or add/delete instantiations to the
instantiations library when we feel inclined to do so.

So, could someone take a look at this problem and figure out what needs to be 
modified in Pooma 2 to make it possible to explicitly instantiate the
View1<Field<T1,T2,T3>,T4>::sv?  Also, let me know if I have not explained
anything clearly enough about the problem.

Thanks for any help you can provide,

-- 
Dave Nystrom                    email: address@hidden
LANL X-3                        phone: 505-667-7913     fax: 505-665-3046


------------------Arch's Test Problem Sent to EDG----------------------
It took the entire afternoon to reduce your example to a
reasonable 41 lines and send it to EDG.
Attached is the reduced case.  I'll let you know when I hear from EDG.

- Arch


//---------------------------------------------------------------------
// Primary templates
//---------------------------------------------------------------------
template<class T> class Field;
template<class Subject> struct Melon;   
template<class Thing> struct Scene {};  
template<int Dim> class Interval;

//---------------------------------------------------------------------
// Partial specializations
//---------------------------------------------------------------------
template<class T>
struct Scene<Field<T> >;

template<class T>
struct Melon<Field<T> > {               // line #X
    typedef T Trouble_t;
};

template<class T>
struct Scene<Field<T> >
{
    typedef Field<T> Subject_t;
#ifndef NO_BUG 
    typedef typename Subject_t::Domain_t Domain_t;
#endif
    // "Melon" below should reference partial specialization on line = #X
    typedef typename Melon< Subject_t >::Trouble_t Trouble_t;
    static const bool sv = true;
};

//---------------------------------------------------------------------
// Other miscellaneous definitions
//---------------------------------------------------------------------
template<class T>
struct Field {
    typedef Interval<3> Domain_t;
    typename Scene<Field<T> >::Trouble_t boil() const;
};

const bool& Zebra = Scene<Field<int> >::sv;

--------------------Final Reply of Arch and EDG--------------------------
My impression is that the Pooma 2 code has errors
that are sensitive to the "point of instantiation",
and it's just dumb luck that implicit instantiation works.

- Arch

-----Original Message-----
From: Dave Nystrom [mailto:address@hidden
Sent: Tuesday, April 10, 2001 12:24 PM
To: Robison, Arch
Cc: 'Dave Nystrom'; 'address@hidden'
Subject: RE: FW: [1C2901] RE: Problems trying to do explicit template
instant iations


OK, but now I am confused about what I need to do in the context of my
original problem.  When this is described as a programmer error, is that
referring to the way in which I am trying to do the instantiation?  Or does
it mean that there is an error in the Pooma 2 code for the View1 template?
Do you understand how to fix the "programmer error"?  Do you understand why
the prelinker is able to do the instantiation but my explicit instantiation
attempt fails?

Dave

Robison, Arch writes:
 > Here's a resend.  - Arch
 > 
 > >  -----Original Message-----
 > > From:      Robison, Arch  
 > > Sent:      Wednesday, April 04, 2001 8:16 AM
 > > To:        'Dave Nystrom'
 > > Cc:        'KCC Support'; Robison, Arch
 > > Subject:   RE: [1C2901]  RE: Problems trying to do explicit template
 > > instantiations
 > > 
 > > EDG says they are doing the right thing.  See below.
 > > The references are to the example that I sent yesterday.
 > > 
 > > After looking at this for a while, I believe that we are doing the
right
 > > thing.
 > > 
 > > As our message says:
 > > 
 > > "t1.c", line 38: error: class "Scene<Field<int>>" has no member
 > > "Trouble_t"
 > >       typename Scene<Field<T> >::Trouble_t boil() const;
 > >                                  ^
 > >           detected during:
 > >             instantiation of class "Field<T> [with T=int]" at line 25
 > >             instantiation of class "Scene<Field<T>> [with T=int]" at
line
 > > 41
 > > 
 > > 
 > > The problem is that the instantiation of Field<int> is initiated by
during
 > > the
 > > instantiation of Scene<Field<int>>, but Field<int> then makes reference
to
 > > a member of Scene<Field<int>> that has not yet been declared
(Trouble_t).
 > > 
 > > Two other compilers (g++ and Borland) give similar messages on this
 > > example.
 > > 
 > > This can be fixed by moving the declaration of Trouble_t to the point
 > > immediately following the declaration of Subject_t.
 > > 
 > > So what you have is a code that is sensitive to the "point of
 > > instantiation".  Since points
 > > of instantiation are defined by the ISO C++ standard, it's a programmer
 > > error, albeit
 > > an obscure and difficult to diagnose one.
 > > 
 > > - Arch
 > 

--------------------------------X.cc-------------------------------------
#include "Pooma/NewFields.h"

// Test instantiation.

#define T1 NoGeometry<(int)3>
#define T2 int
#define T3 CompressibleBrickView
#define T4 Interval<(int)3>
template View1<Field<T1,T2,T3>,T4>::sv;
#undef T1
#undef T2
#undef T3
#undef T4

-----------------------------Build-Log-----------------------------------
cd 
/usr/projects/blanca/usr/wdn/blanca_src_4.0/TecIntegrationLayer/Pooma2Integration/
date; /usr/bin/time -p make RECURSE=1 app

Setting csh aliases for Blanca source environment v 4.0 on host: mutley
Wed May  2 17:16:38 MDT 2001

COMPILING... See 
/scratch/wdn/obj_4.0/POOMA2INTEGRATION/LINUX_KCC_CART_XYZ_DEBUG/Pooma2Integration_src/TecMesh/X.o_1.info

KCC -c 
/usr/projects/blanca/usr/wdn/blanca_src_4.0/TecIntegrationLayer/Pooma2Integration/Pooma2Integration_src/TecMesh/X.cc
 -o 
/scratch/wdn/obj_4.0/POOMA2INTEGRATION/LINUX_KCC_CART_XYZ_DEBUG/Pooma2Integration_src/TecMesh/X.o
 --output_dependencies 
/scratch/wdn/obj_4.0/POOMA2INTEGRATION/LINUX_KCC_CART_XYZ_DEBUG/Pooma2Integration_src/TecMesh/X.o.depend.mk.temp
 --diag_suppress 630 --COMPDO_fe_cc2c --pch_ignore_dir --use_pch 
/scratch/wdn/obj_4.0/POOMA2INTEGRATION/LINUX_KCC_CART_XYZ_DEBUG/POOMA2INTEGRATION_1.pch
 -DTEC_USE_POOMA2INTEGRATION -DTEC_USE_TECFRAMEWORK 
-DTEC_USE_POOMA2INSTANTIATIONS -DTEC_USE_STLINSTANTIATIONS -DTEC_USE_POOMA 
-DTEC_USE_CHEETAH -DTEC_USE_MM -DTEC_USE_PCG -DCART_XYZ -DDOUBLE_PRECISION 
-DPETE -DV034 -DTEC_NEW_POOMA_COMPRESSION -DTEC_USE_EXCEPTIONS -DTEC_LINUX 
-DTEC_USING_KCC_DEFINES -DTEC_KCC_INFINITE_COMPILE_TIME -DTEC_SINGLE_BRICK 
-DTEC_INST -DTEC_USE_PCH 
-I/usr/projects/blanca/usr/wdn/blanca_src_4.0/TecIntegrationLayer/Pooma2Integration
 -I/usr/projects/blanca/packages/TecFramework 
-I/usr/projects/blanca/packages/BlancaInstantiations/Pooma2Instantiations 
-I/usr/projects/blanca/packages/BlancaInstantiations/STLInstantiations 
-I/usr/projects/blanca/packages/PoomaII/r2/src 
-I/usr/projects/blanca/packages/PoomaII/r2/lib/LINUX_KCC_DEBUG_CHEETAH 
-I/usr/projects/blanca/packages/Cheetah/cheetah-1.0.0/src 
-I/usr/projects/blanca/packages/Cheetah/cheetah-1.0.0/lib/LINUX_KCC_DEBUG 
-I/home/wdn/packages/mpich-1.2.1/include 
-I/usr/projects/blanca/packages/mm-1.1.1/include 
-I/usr/projects/blanca/packages/pcg/pcg_f77 --display_error_number -fpic 
--strict -D__KAI_STRICT --diag_suppress 450 +K0 --no_kdebug

"/usr/projects/blanca/packages/PoomaII/r2/src/NewField/Field.h", line 1013: 
error #135: 
          class "View1<Field<NoGeometry<3>, int, CompressibleBrickView>,
          Interval<3>>" has no member "ReadType_t"
    inline typename View1<This_t, Domain_t>::ReadType_t 
                                             ^
          detected during:
            instantiation of class "Field<GeometryTag, T, EngineTag> [with
                      GeometryTag=NoGeometry<3>, T=int,
                      EngineTag=CompressibleBrickView]" at line 440
            instantiation of class "View1<Field<G1, T1, E1>, Sub1> [with
                      GeometryTag=NoGeometry<3>, T=int,
                      EngineTag=CompressibleBrickView, Sub1=Interval<3>]" at
                      line 9 of
                      "/usr/projects/blanca/usr/wdn/blanca_src_4.0/TecIntegrati
                      onLayer/Pooma2Integration/Pooma2Integration_src/TecMesh/X
                      .cc"

"/usr/projects/blanca/packages/PoomaII/r2/src/NewField/Field.h", line 1020: 
error #135: 
          class "View1<Field<NoGeometry<3>, int, CompressibleBrickView>,
          Interval<3>>" has no member "ReadType_t"
    inline typename View1<This_t, Domain_t>::ReadType_t 
                                             ^
          detected during:
            instantiation of class "Field<GeometryTag, T, EngineTag> [with
                      GeometryTag=NoGeometry<3>, T=int,
                      EngineTag=CompressibleBrickView]" at line 440
            instantiation of class "View1<Field<G1, T1, E1>, Sub1> [with
                      GeometryTag=NoGeometry<3>, T=int,
                      EngineTag=CompressibleBrickView, Sub1=Interval<3>]" at
                      line 9 of
                      "/usr/projects/blanca/usr/wdn/blanca_src_4.0/TecIntegrati
                      onLayer/Pooma2Integration/Pooma2Integration_src/TecMesh/X
                      .cc"

"/usr/projects/blanca/packages/PoomaII/r2/src/NewField/Field.h", line 1051: 
error #135: 
          class "View1<Field<NoGeometry<3>, int, CompressibleBrickView>,
          Interval<3>>" has no member "Type_t"
    inline typename View1<This_t, Domain_t>::Type_t 
                                             ^
          detected during:
            instantiation of class "Field<GeometryTag, T, EngineTag> [with
                      GeometryTag=NoGeometry<3>, T=int,
                      EngineTag=CompressibleBrickView]" at line 440
            instantiation of class "View1<Field<G1, T1, E1>, Sub1> [with
                      GeometryTag=NoGeometry<3>, T=int,
                      EngineTag=CompressibleBrickView, Sub1=Interval<3>]" at
                      line 9 of
                      "/usr/projects/blanca/usr/wdn/blanca_src_4.0/TecIntegrati
                      onLayer/Pooma2Integration/Pooma2Integration_src/TecMesh/X
                      .cc"

"/usr/projects/blanca/packages/PoomaII/r2/src/NewField/Field.h", line 1058: 
error #135: 
          class "View1<Field<NoGeometry<3>, int, CompressibleBrickView>,
          Interval<3>>" has no member "Type_t"
    inline typename View1<This_t, Domain_t>::Type_t 
                                             ^
          detected during:
            instantiation of class "Field<GeometryTag, T, EngineTag> [with
                      GeometryTag=NoGeometry<3>, T=int,
                      EngineTag=CompressibleBrickView]" at line 440
            instantiation of class "View1<Field<G1, T1, E1>, Sub1> [with
                      GeometryTag=NoGeometry<3>, T=int,
                      EngineTag=CompressibleBrickView, Sub1=Interval<3>]" at
                      line 9 of
                      "/usr/projects/blanca/usr/wdn/blanca_src_4.0/TecIntegrati
                      onLayer/Pooma2Integration/Pooma2Integration_src/TecMesh/X
                      .cc"

"/usr/projects/blanca/usr/wdn/blanca_src_4.0/TecIntegrationLayer/Pooma2Integration/Pooma2Integration_src/TecMesh/X.cc",
 line 9: error #77-D: 
          this declaration has no storage class or type specifier
  template View1<Field<T1,T2,T3>,T4>::sv;
           ^

"/usr/projects/blanca/usr/wdn/blanca_src_4.0/TecIntegrationLayer/Pooma2Integration/Pooma2Integration_src/TecMesh/X.cc",
 line 9: error #147: 
          declaration is incompatible with "const bool View1<Field<G1, T1,
          E1>, Sub1>::sv [with GeometryTag=NoGeometry<3>, T=int,
          EngineTag=CompressibleBrickView, Sub1=Interval<3>]" (declared at
          line 446 of
          "/usr/projects/blanca/packages/PoomaII/r2/src/NewField/Field.h")
  template View1<Field<T1,T2,T3>,T4>::sv;
                                      ^

6 errors detected in the compilation of 
"/usr/projects/blanca/usr/wdn/blanca_src_4.0/TecIntegrationLayer/Pooma2Integration/Pooma2Integration_src/TecMesh/X.cc".
KCC: Compilation failed.
Command exited with non-zero status 2
real 18.00
user 12.97
sys 1.24

Error compiling 
/scratch/wdn/obj_4.0/POOMA2INTEGRATION/LINUX_KCC_CART_XYZ_DEBUG/Pooma2Integration_src/TecMesh/X.o
make: *** 
[/scratch/wdn/obj_4.0/POOMA2INTEGRATION/LINUX_KCC_CART_XYZ_DEBUG/Pooma2Integration_src/TecMesh/X.o]
 Error 9
Command exited with non-zero status 2
real 24.05
user 16.34
sys 1.44

Compilation exited abnormally with code 2 at Wed May  2 17:17:02

reply via email to

[Prev in Thread] Current Thread [Next in Thread]