This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: alignment warning


K,Avvesdi Gy,Avrgy writes:
 > Here is the output:
 > 

I'm baffled by this.

avr.h:

/* No data type wants to be aligned rounder than this.  */
#define BIGGEST_ALIGNMENT 8

defaults.h:

/* Biggest alignment supported by the object file format of this machine.  */
#ifndef MAX_OFILE_ALIGNMENT
#define MAX_OFILE_ALIGNMENT BIGGEST_ALIGNMENT
#endif

varasm.c:

  /* Some object file formats have a maximum alignment which they support.
     In particular, a.out format supports a maximum alignment of 4.  */
  if (align > MAX_OFILE_ALIGNMENT)
    {
      warning (0, "alignment of %q+D is greater than maximum object "
               "file alignment.  Using %d", decl,
	       MAX_OFILE_ALIGNMENT/BITS_PER_UNIT);
      align = MAX_OFILE_ALIGNMENT;
    }

And the compiler outputs:

 > x.cpp:2: warning: alignment of $,1rxc1::_ZTV2c1$,1ry is greater than maximum object 
 > file alignment.  Using 1

Now the definition of BIGGEST_ALIGNMENT is

 -- Macro: BIGGEST_ALIGNMENT
     Biggest alignment that any data type can require on this machine,
     in bits.

So, the maximum alignment on AVR is one byte, but for some reason the
alignment of the vtable is set to something greater than that.  What I
don't know is whether the vtable alignment really needs to be more
than one byte.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]