This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: Compiler Memory Alignment Issue


Johannes, Richard, Bob, Martin, All,

On Friday 03 February 2012 15:13:59 Johannes Stezenbach wrote:
> On Fri, Feb 03, 2012 at 02:21:23PM +0100, Yann E. MORIN wrote:
> > On Friday 03 February 2012 11:16:27 Bob Dunlop wrote:
> > > On Thu, Feb 02 at 01:15, Richard Koch wrote:
> > > > I'm seeing an alignment issue when I'm incrementing a pointer.
> > 
> > I Just tried your .config and your sample C code, and it seems to work here
> > (with the buffer overflow fixed):
> 
> As Martin Guy pointed out the issue may be caused
> by wrong alignment.  In fact the behaviour of the code
> is undefined according to C99 if buffer is not suitably aligned:
> https://www.securecoding.cert.org/confluence/display/seccode/EXP36-C.+Do+not+convert+pointers+into+more+strictly+aligned+pointer+types

Indeed, but with the same .config (ie the same compiler settings), and the
same code, I get a correct result, where Richard does not.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |   ^                |
| --==< O_o >==-- '------------.-------:  X  AGAINST      |  /e\  There is no  |
| http://ymorin.is-a-geek.org/ | (*_*) | / \ HTML MAIL    |  """  conspiracy.  |
'------------------------------'-------'------------------'--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq


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