buglwIP - A Lightweight TCP/IP stack - Bugs: bug #19052, ppp.h version 1.2 has broken...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #19052: ppp.h version 1.2 has broken Macros GETSORT/LONG

Submitter:  None
Submitted:  Tue 13 Feb 2007 04:39:22 PM UTC
   
 
Category:  Contrib Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  None

Thu 24 May 2007 05:32:39 AM UTC, comment #3: 

Len writes below:

> Unfortunately, in my compiler at least,
> taking a byte/char and shifting it left
> by more than 7 bits is optimised completely
> away


If that's the Renesas/Mitsubishi NC308 compiler for the M16C and M32C CPU chips, then add te command line option "-fETI" (Extend (bytes) To Integer) so as to be (sligtly more) ANSI compliant.

The original reporter of #9191 (bjorn sundman?) was using this compiler.

Those with these problems using OTHER compilers should check their compiler manuals for options to force correct (ANSI) operation.

Tom Evans <tom_evans>
Wed 14 Feb 2007 08:18:36 AM UTC, comment #2: 

Fixed this in CVS HEAD, previous fix for #9191 was indeed broken.
Please, test and report back if this case can be closed.

Christiaan Simons <christiaans>
Group Member
Wed 14 Feb 2007 07:57:14 AM UTC, comment #1: 

I expect the second line of the macro should contain (s)<<=8;

I think this is attempting to work around a problem which recurs (for me) many times throughout lwip.
There are many macros which attempt to construct 16- or 32-bit quantities by taking a number of bytes and shifting them left various amounts. Unfortunately, in my compiler at least, taking a byte/char and shifting it left by more than 7 bits is optimised completely away UNLESS the value is first cast to a u16_t or a u32_t.

Len Chisholm.

Len Chisholm <kiwirail>
Tue 13 Feb 2007 04:39:22 PM UTC, original submission:  

#define GETSHORT(s, cp) { \
    (s) = *(cp); (cp)++; (s) << 8; \
                         ^^^^^^^^ useless
    (s) |= *(cp); (cp)++; \
}

Version 1.1 was correct:
#define GETSHORT(s, cp) { \
    (s) = *(cp)++ << 8; \
    (s) |= *(cp)++; \
}

Same for GETLOG, with the resolt, that PPP connections fails
with bad LCP states...

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by tom_evans (Posted a comment)
  • -email is unavailable- added by kieranm (Updated the item)
  • -email is unavailable- added by christiaans (Posted a comment)
  • -email is unavailable- added by kiwirail (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-02-28 kieranm Open/ClosedOpen Closed
    2007-02-26 kieranm StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code