ACLiC fatal error on union

Hi Rooters,

Why ACLiC cause fatal error and core-dump on union?

A simple code (ACLiC.cxx) generates the following message and return to Linux:
Fatal: sizeof(::_ColRec) == sizeof(::ROOT::Shadow::_ColRec) violated at
line 73 of `fileRndAvp.cxx’
aborting

I could not suppose the reasons to generate an object related to C-structure
in such way in fileRndAvp.cxx:

namespace ROOT { // LINE # 32 namespace Shadow { #if !(defined(R__ACCESS_IN_SYMBOL) || defined(R__USE_SHADOW_CLASS)) typedef ::_ColRec _ColRec; #else class _ColRec { public: //friend XX; #if !(defined(R__ACCESS_IN_SYMBOL) || defined(R__USE_SHADOW_CLASS)) typedef ::_ColRec::U1 U1; #else class U1 { public: //friend XX; int* intVec; // float* floatVec; // }; #endif
— Cut ----

  // Make sure the shadow class has the right sizeof
  R__ASSERT(sizeof(::_ColRec) == sizeof(::ROOT::Shadow::_ColRec)); // LINE #73

Let me know workarounds to continue my project.
Thanks, Yuki

ACLiC.cxx
#include <stdio.h>
  typedef struct _ColRec {
    char * name ; 
    union U1   {
      int       * intVec    ;
      float     * floatVec  ;
    } data ;
  } ColRec ;
  typedef ColRec  * Col ;

int ACLiC( Col col ) {
  printf("%s\n", col->name ) ;
  return 1 ;
}

Hi Yuki!

Thanks for reporting, this was a bug! It’s now fixed in the subversion trunk. You will have to update to the current ROOT sources, see root.cern.ch/twiki/bin/view/ROOT … _ROOT_Subv

Cheers, Axel.

Axel-san,

Thank you for your quick fixing, which makes me a ROOT fan.
:smiley:

Sincerely, Yuki