Bug 28902 - Fix for "alingment of XXX is greater than maximum object alignment" on AVR
Summary: Fix for "alingment of XXX is greater than maximum object alignment" on AVR
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.0
: P3 minor
Target Milestone: 4.2.1
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2006-08-30 12:47 UTC by Rolf Magnus
Modified: 2007-09-06 21:17 UTC (History)
2 users (show)

See Also:
Host:
Target: avr-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-09-03 05:30:50


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf Magnus 2006-08-30 12:47:12 UTC
The avr target gives that alignment warning for every polymorphic class, because it doesn't define TARGET_VTABLE_ENTRY_ALIGN, which means the default kicks in, which is the size of a pointer. Since the AVR as an 8 bit platform has no alignment requirements, BIGGEST_ALIGNMENT is 8, which is less than the pointer size. The fix is trivial. A patch against trunk follows:

Index: gcc/config/avr/avr.h
===================================================================
--- gcc/config/avr/avr.h        (revision 116509)
+++ gcc/config/avr/avr.h        (working copy)
@@ -94,6 +94,7 @@
 /* No data type wants to be aligned rounder than this.  */
 #define BIGGEST_ALIGNMENT 8

+#define TARGET_VTABLE_ENTRY_ALIGN 8

 #define STRICT_ALIGNMENT 0
Comment 1 Andrew Pinski 2006-09-03 05:30:50 UTC
Confirmed, can you send your patch to gcc-patches@ as mentioned on 
http://gcc.gnu.org/contribute.html
With all the requested information with the email as requested by that page.
Comment 2 aesok 2007-09-03 20:35:20 UTC
Subject: Bug 28902

Author: aesok
Date: Mon Sep  3 20:35:10 2007
New Revision: 128059

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128059
Log:
	PR target/28902
 	* config/avr/avr.h (TARGET_VTABLE_ENTRY_ALIGN): Define.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr.h

Comment 3 aesok 2007-09-03 21:04:03 UTC
Subject: Bug 28902

Author: aesok
Date: Mon Sep  3 21:03:50 2007
New Revision: 128060

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128060
Log:
	PR target/28902
 	* config/avr/avr.h (TARGET_VTABLE_ENTRY_ALIGN): Define.


Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/config/avr/avr.h

Comment 4 aesok 2007-09-06 21:17:42 UTC
Fixed.