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

Submitted by:  None
Submitted on:  Tue 13 Feb 2007 04:39:22 PM UTC  
 
Category: ContribSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned 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>
Project 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

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 28 Feb 2007 01:52:59 PM UTCkieranmOpen/ClosedOpen=>Closed
    Mon 26 Feb 2007 12:55:15 PM UTCkieranmStatusNone=>Fixed

    Back to the top


    Powered by Savane 3.1-cleanup1