lwip-devel
[Top][All Lists]
Advanced

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

RE: [lwip-devel] memory alignment in 32bit architecture


From: Grubb, Jared
Subject: RE: [lwip-devel] memory alignment in 32bit architecture
Date: Fri, 20 Mar 2009 13:22:50 -0700

My first suggestion would be that the dhcp struct could get reordered to ensure 
that ip_addr will be properly aligned, but it appears that it already should be 
(as long as the dhcp* is properly aligned).

So, I'm guessing it's the compiler being confused by the unnecessary cast. The 
compiler MIGHT be complaining about taking the address  &(__.addr) since this 
is a u32_t*, and not the cast to ip_addr*.

Given:

struct dhcp {
  //....
  struct ip_addr offered_dns_addr[DHCP_MAX_DNS]; /* DNS server addresses */
};


This line:
      dns_setserver( n, (struct ip_addr *)(&(dhcp->offered_dns_addr[n].addr)));
should be changed to:
      dns_setserver( n, &(dhcp->offered_dns_addr[n]));

That might fix it? 

Jared

> -----Original Message-----
> From: address@hidden [mailto:lwip-
> address@hidden On Behalf Of Piero 74
> Sent: Friday, March 20, 2009 1:09 PM
> To: lwip-devel
> Subject: Re: [lwip-devel] memory alignment in 32bit architecture
> 
> my micro will generate a data abort exception.
> 
> what solution do you suggest?
> do you think that dns code is not well done (i want to say... portable
> without changes)?
> 
> piero
> 
> 
> 2009/3/20, Bill Auerbach <address@hidden>:
> > I'd trust the compiler on this one and say it's bad.  If it does end
> up
> > unaligned, you'll get either bad data or a exception trap depending
> on what
> > your processor does for this case.
> >
> > Bill
> >
> >>-----Original Message-----
> >>From: address@hidden
> >>[mailto:address@hidden On
> >>Behalf Of Piero 74
> >>Sent: Friday, March 20, 2009 2:46 PM
> >>To: lwip-devel
> >>Subject: Re: [lwip-devel] memory alignment in 32bit architecture
> >>
> >>Simon, as you said was my understanding.
> >>but, why i have this warning:
> >>
> >>"i'm trying to use lwip in cvs head...
> >>
> >> i tried the compilation, and i saw in these piece of code (file
> dhcp.c)
> >>
> >> #if LWIP_DNS
> >>       dns_setserver( n, (struct ip_addr *)(&(dhcp-
> >>>offered_dns_addr[n].addr)));
> >> #endif /* LWIP_DNS */
> >>
> >> a warning like this:
> >> Warning[Pa039]: use of address of unaligned structure member
> >>....\lwip\src\core\dhcp.c 539
> >>"
> >>
> >>bye
> >>Piero
> >
> >
> >
> >
> > _______________________________________________
> > lwip-devel mailing list
> > address@hidden
> > http://lists.nongnu.org/mailman/listinfo/lwip-devel
> >
> 
> 
> _______________________________________________
> lwip-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-devel




reply via email to

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