Release Notes for MPLAB® C18 C Compiler
v3.10
16 February 2007
Table of Contents

1. How the Student Edition Differs from the Full Version
2. Important Backward Compatibility Notes
3. What's New in This Release
4. What's Been Fixed Since v3.00
5. Devices Supported
6. MPLAB C18 C Compiler Documentation
7. Documentation Update
8. Installation
9. Using MPLAB C18 with the MPLAB IDE
10. Known Problems
11. Contributors
12. Customer Support

1. # How the Student Edition Differs from the Full Version

   MPLAB C18 is available as either a Student Edition or a full version. This Read Me file is the same in both.

   For 60 days, the Student Edition of MPLAB C18 will function as the full version. After 60 days, the MPLAB C18 Student Edition differs from the full version in the following ways:

   - Not all optimizations will be supported. Namely, procedural abstraction will not be supported.
   - The PIC18 Extended mode (extended instruction set and indexed with literal offset addressing) will not be supported.

   To purchase a full version of the MPLAB C18 C compiler, please contact your local distributor or visit http://buy.microchip.com.

2. # Important Backward Compatibility Notes

## MPLAB C18 Storage Qualifier Handling

The changes to fix SSR 22612 in MPLAB C18 v3.06 affect programs written without consideration of C language specifications regarding the syntactic use of `const`, `volatile`, `rom`, `ram`, `near`, and `far` qualifiers for user defined types using `typedef`. An error or a warning will be generated if the compiler detects such problems in code.

For example in the following code:

    typedef char * cPtr_t;
    cPtr_t rom rompc;
    rom char romc;
    void f(void)
    {
      rompc = &romc;
    }

`rompc` should be `[rom pointer to ram char]` so MPLAB C18 v3.06 and later produce a warning indicating there is a qualifier mismatch in assignment. Please note that this program compiles with no warning in MPLAB C18 prior to this fix because in those versions, `rompc` was incorrectly qualified as `[ram pointer to rom char]`. Since `romc` was in rom there was no mismatch in type and qualification for this assignment in earlier versions of MPLAB C18.

The qualifiers `rom`, `ram`, `near`, and `far` are specific to MPLAB C18. While different from `const` and `volatile` from a semantic point of view, they are parsed in the same syntactic context, hence the above example is applicable to all qualifiers. (For more information on the syntax of using qualifiers please refer to your C programming language reference manual. For a description of `rom`, `ram`, `near`, and `far` qualifiers please refer to the "Storage Qualifiers" section of the MPLAB C18 C Compiler User's Guide.)

## MPLINK and MPLAB IDE COFF File Format

Due to a change in COFF file format, MPLAB C18 v3.00 and later will not be compatible with versions of MPLINK prior to v4.00 or versions of the MPLAB IDE prior to v7.21.

MPLAB C18 v3.00 and later will have backward compatibility to earlier versions at the source level only. Any existing object files or libraries compiled with earlier versions of the tools will not link using new versions of the tools. They will need to be recompiled from source.

If the user attempts to use this release with object files or libraries compiled with earlier versions of MPLAB C18, MPLINK, and MPASM, the error message that will be received will be similar to:

`Error - Coff file format for 'C:\mcc18\lib/c018i.o' is out of date.`

If the user attempts to use an old version of MPLINK to link object files or libraries compiled with this release, the error message that will be received will be similar to:

`Error - Coff file format for 'C:\mcc18\lib/c018i.o' does not appear to be a valid COFF file.`

3. # What's New in This Release

   - Early adopter part support added. See "Devices Supported" below.
   - Several bug fixes. See "What's Been Fixed Since v3.00" below.
   - Support for MPLAB REAL ICE Instrumented Trace is provided.

4. # What's Been Fixed Since v3.00:

   1. Fixed between v3.06 and 3.10:
      (22771)
        A legal redeclaration of an array could change the size of the array.
      (18405)
        Two global declarations using the same name could cause problems for the banking optimizer if the declarations were located in different banks. Now an error is generated when the same name is used to declare objects in different sections.
      (C18-261)
        Some registers and bits are were removed from support files for the 18F97J60 family of devices because they are reserved.
        LATECOL was removed from ESTAT.
        NOBKOFF and BPEN were removed from MACON4.
        MICON register was removed.
        MACLCON2 register was removed.
        MACLCON1 register was removed.
      (C18-262)
        Aliases were added to support files for 18F87J11 and 18F87J50 families of devices for some registers and bits.
        aliases CM1CON and CM2CON for registers CM1CON1 and CM2CON1.
        alias CMSTAT for register CMSTATUS.
        alias BAUDCON for register BAUDCON1.
        aliases U2OD and U1OD for bits USART1OD and USART1OD of registerODCON2.
        alias ADSHR for bit DEVCFG of register WDTCON.
        Also, the unimplemented bit PFRZ was removed from PMCONH for these devices.
      (C18-263)
        Aliases BAUDCON for register BAUDCON1 and RCREG for register RCREG1 were added to support files for the 18F87J10 family of devices.
      (C18-265)
        The devices 18F2410 and 18F4410 were added to the USART.h header file.
   2. Fixed between v3.05 and 3.06:
      (22612)
        Combining a typedef name with a 'rom' type qualifier in a declaration would assign the incorrect type if 'rom' followed the typedef name.
      (28973)
        Modifications were required in the support files for the 18F87J50 and 18F87J11 families.
        The following modifications were made to bit names in these support files:
        PMDATA1L renamed PMDIN1L
        PMDATA1H renamed PMDIN1H
        PMDATA2L renamed PMDIN2L
        PMDATA2H renamed PMDIN2H
        ADCON1 renamed ADCON0
        ADCON2 renamed ADCON1
        PADCFGH renamed ANCON0
        PADCFGL renamed ANCONH
        VREGSLP renamed REGSLP (in WDTCON register)
      (28979)
        Setting for 2.0V BOR is removed from support files for 18F1320.
      (29218)
        The descriptions of WRTB and WRTC configuration bits in support files for 18F2455 and 18F4455 were swapped, but have been corrected. The WRTB affects the write protection of the boot block, and the WRTC affects the configuration registers.
      (29219)
        The descriptions of WRTB and WRTC configuration bits in 18F2455 and 18F4455 were swapped in the MPLAB C18 Config Settings Addendum (DS51537 revision E). This document is now obsolete, and has been replaced with the help file, hlpPIC18ConfigSet.chm. The descriptions of these configuration bits in the help file in this release have been corrected.
      (29261)
        Support files for the 18F45K20 family of devices were changed to match the datasheet.
        The following changes were made:
        Register PSTCON renamed PSTRCON
        Added CKTXP (bit 4) and DTRXP (bit 5) to BAUDCTL
        Changed IPR2 (bit 5) from CM2IP to C2IP
        Changed IPR2 (bit 6) from CM1IP to C1IP
        Changed PIR2 (bit 5) from CM2IF to C2IF
        Changed PIR2 (bit 6) from CM1IF to C1IF
        Changed PIE2 (bit 5) from CM2IE to C2IE
        Changed PIE2 (bit 6) from CM1IE to C1IE
        Added TUN5 (bit 5) to OSCTUNE
        Added MSK0-MSK7 bits to SSPMSK register
        Updated configuration setting descriptions to match datasheet
      (29287)
        In support files for 18F4550, 18F4455, 18F2550, 18F2455, 18F4450, and 18F2450, bit name FCMEM in CONFIG1H was changed to FCMEN to match the datasheet, DS39632C.
   3. Fixed between v3.04 and 3.05:
      (28977)
        UFRMH bits 0-2 (FRM8 - FRM10) and UFRML bits 0-8 (FRM0 - FRM7) were added to device support files for the 18F4450 family of devices to match data sheet DS39760A.
      (28978)
        Device support files for the 18F85J90 family were modified to match data sheet DS39770A. The following changes were made:
        MEMCON register has been removed.
        DISCARD bit in ADCON0 has been removed.
        PSPIP bit in IPR1 register has been removed.
        LATE bit in LATE register has been removed.
        PSPIE bit in PIE1 register has been removed.
        PSPIF bit in PIR1 register has been removed.
        TRISE2 bit in TRISE register has been removed.
      (21905/27748)
        Invocations of functions with return values larger than 32 bits retrieved the return value in an interrupt unsafe manner.
      (23715)
        Enumeration value 127+1 extended to 0xFF80 instead of 0x0080.
      (28489)
        RE3 (PORTE) is not available as input on devices 18F2331/2431 and has been removed from header files.
      (28600)
        Some unimplemented GPR locations defined in header files for all 18F97J60 family devices have been removed.
      (28696)
        For 18F85J11, 18F84J11 and 18F83J11, the config directive for the External Memory Bus Configuration bits (MODE =) defined the bits in reverse order.
        Note: The workaround recommended in the Read Me file for release v3.04 is no longer correct. Instead simply use the #pragma config directive as described in the Config Settings Help file.
      (28789)
        The RE3 bit of PORTE was missing in header files for the 18F2221 and 18F2321 devices.
   4. Fixed between v3.03 and 3.04:
      (28128)
        Names of macros DLB_EPSILON and LDLB_EPSILON in float.h deviated from names of macros in ANSI specification, DBL_EPSILON and LDBL_EPSILON.
      (28345)
        (non-extended mode only) An invalid error message, "Could not resolve section reference MATH_DATA" was given when MATH_DATA section was saved by ISR but not used in the application.
      (28184)
        Values in an array at offsets greater than 128 were accessed incorrectly.
      (28368)
        Definitions of PSP* bits were removed from the header files for 18F2220 and 18F2320. These bits are not implemented on these devices.
      (28292)
        INTEDG2 bit of INTCON2<4>, was missing from header files of 18F458 family devices.
   5. Fixed between v3.02 and 3.03:
      (28214)
        For the 18F4550 family, the following list of volatile SFRs were not treated as volatile in the device support files:

              SPPCFG
              SPPCON
              SPPEPS
              UCON
              UADDR
              UCFG
              UEP0
              UEP1
              UEP2
              UEP3
              UEP4
              UEP5
              UEP6
              UEP7
              UEP8
              UEP9
              UEP10
              UEP11
              UEP12
              UEP13
              UEP14
              UEP15

        Support files for the following devices were corrected:
        18F2450, 18F2455, 18F2550, 18F4450, 18F4455, and 18F4550.
      (27893)
        Bits were missing in support files for devices 18F1330 and 18F1230 according to data sheet DS39758A.
        SEVTEN (ADCON0<7>) and INTSRC (OSCTUNE<7>) have been added.
        CVROE (CVRCON<6>) and FLTCON (FLTCONFIG) are unimplemented and were removed.
        Correct bit names for DTCON have been added.
      (27953)
        For 18F87J10, the config directive for the Processor Mode Selection (External Memory Bus Configuration) bits (MODE =) defined the bits in reverse order.
        The bits are now defined in the correct order.
        NOTE: The workaround recommended for this issue in a previous release, v3.02, is no longer valid.
        When using the #pragma config directive, please follow the instructions in the PIC18 Config Settings Help file for Processor Mode Selection:

        MM | instead of XM20 | for MCU mode - External bus disabled
        XM12 | instead of XM16 | for Extended MCU mode, 12-bit Address mode
        XM16 | instead of XM12 | for Extended MCU mode, 16-bit Address mode
        XM20 | instead of MM | for Extended MCU mode, 20-bit Address mode

        The MPLAB IDE settings were always correct. Only the #pragma config directive settings were incorrect.
      (28136)
        The 18F4680 family support files did not match data sheet DS39625B.
        Configuration Word changes for 18F2585/2680/4584/4680:
        ------------------------------------------------------
        OSC setting - ERC value has been removed. Use RC
        OSC setting - ERC1 value has been removed. Use RC
        FCMENB setting has been changed to FCMEN
        IESOB setting has been changed to IESO
        BOR setting has been changed to BOREN
        BORV setting value 20 has been changed to 3
        BORV setting value 27 has been changed to 2
        BORV setting value 42 has been changed to 1
        BORV setting value 45 has been changed to 0
        Additional Configuration Word changes for 18F2585/4585:
        --------------------------------------------------------
        CP3 setting has been removed
        WRT3 setting has been removed
        EBTR3 setting has been removed
        SFR changes for 18F2585/2680/4585/4680 .h files:
        ------------------------------------------------
        CANSTAT bit 1 has been renamed from ICODE0 to ICODE1
        CANSTAT bit 2 has been renamed from ICODE1 to ICODE2
        CANSTAT bit 3 has been renamed from ICODE2 to ICODE3
        T3ECCP1 (on T3CON) was incorrectly defined as bit 5 but has been corrected to bit 6.
      (26624)
        In the header file for 18F8680 the FIFOWMIF bit was missing from PIR3.
      (27988)
        RE3 bit of PORTE was missing in 18F2431 and 18F2331 devices header files and INC files. It has been added.
      (27157)
        Some SFRs and bits were missing from the 18F2480\2580\4480\4580 devices according to data sheet DS39637A.
        The following updates have been made to device support files:
        Configuration Word changes for 18F2480/2580/4480/4580:
        -----------------------------------------------------
        OSC setting - ERC value has been removed. Use RC
        OSC setting - ERC1 value has been removed. Use RC
        FCMENB setting has been changed to FCMEN
        IESOB setting has been changed to IESO
        BOR setting has been changed to BOREN
        BORV setting value 20 has been changed to 3
        BORV setting value 27 has been changed to 2
        BORV setting value 42 has been changed to 1
        BORV setting value 45 has been changed to 0
        Additional Configuration Word changes for 18F4480:
        --------------------------------------------------
        CP2 and CP3 settings have been removed
        WRT2 and WRT3 settings have been removed
        EBTR2 and EBTR3 settings have been removed
        SFR changes for 18F2480/2580/4480/4580 .h files:
        ------------------------------------------------
        T3ECCP1 (on T3CON) was incorrectly defined as bit 5 but has been corrected to bit 6
        EXIDEN (on RXF1SIDL)was incorrectly defined as bit 1 but has been corrected to bit 3
        EXIDE (on B1SIDL)was incorrectly defined as bit 1 but has been corrected to bit 3
        CANSTAT bit 1 has been renamed from ICODE0 to ICODE1
        CANSTAT bit 2 has been renamed from ICODE1 to ICODE2
        CANSTAT bit 3 has been renamed from ICODE2 to ICODE3
      (21933)
        Using the name of a structure variable instead of the structure tag in the return type of a function could generate a crash.
      (27927)
        The "pow" function generated a link time error if the default storage class was static.
      (27943)
        An array of struct as a member of of another struct would cause an invalid COFF file.
   6. Fixed between v3.01 and 3.02:
      (27624)
        Using any of a set of symbols reserved for use by the compiler caused the compiler to emit a "type mismatch in redeclaration" error. The following symbols are no longer reserved for use by the compiler:

              AEXP
              BEXP
              AARGB0
              AARGB1
              AARGB2
              AARGB3
              AARGB4
              AARGB5
              AARGB6
              AARGB7
              BARGB0
              BARGB1
              BARGB2
              BARGB3
              REMB0
              REMB1
              REMB2
              REMB3
              TEMP
              TEMPB0
              TEMPB1
              TEMPB2
              TEMPB3
              FPFLAGS
              FPFLAGSbits

        If you are using any of these names to refer to the math library's variables, these can now be accessed by prefixing the symbol name with two underscores (e.g., __FPFLAGS).
      (27800)
        Auto context saving saved a symbol twice if the symbol was in the "save=" clause and auto context saving determined it needed to save the symbol.
      (27884)
        The header files for the 18F87J10 family of devices were missing SSPCON bits. Per DS39663B, SSP1CON2 bits 1 through 5 and SSP2CON2 bits 1 through 5 (ADMSK1-ADMSK5) were added.
      (27895)
        Header files for 18F4450 and 18F2450 did not have support for EUSART. BAUDCON, SPBRGH, EECON1 and EECON2 registers have been added. Missing bit SENDB on TXSTA register was added.
   7. Fixed between v3.00 and 3.01:
      (24022)
        Compiler crashes on pointer arithmetic using pointer to incomplete tag (illegal code).
      (24411)
        Cannot use a comma-containing constant string as an argument to a macro.
      (24420)
        atob() function, called with a string containing a negative value, corrupts the software stack.
      (26834)
        (Extended-mode only) Struct assignment with pointer arithmetic has been fixed.
      (27682)
        TABLAT could be corrupted by function epilogue code.
      (27358 / 27515)
        The #pragma config directive causes unimplemented bits to become 0, but should be left a '1'.
        Unimplemented/reserve bits are now included in the mask and default settings when the bit must be maintained set.
        Following are the devices and configuration words that were corrected:

                    18C442  CONFIG1H, CONFIG4L
                    18C452  CONFIG1H, CONFIG4L
                    18C658  CONFIG1H, CONFIG4L
                    18C858  CONFIG1H, CONFIG4L
                    18F242  CONFIG5L, CONFIG6L, CONFIG7L
                    18F442  CONFIG5L, CONFIG6L, CONFIG7L
                    18F6525 CONFIG3L, CONFIG5L, CONFIG6L, CONFIG7L
                    18F6621 CONFIG3L
                    18F8525 CONFIG5L, CONFIG6L, CONFIG7L
                    18F2220 CONFIG5L, CONFIG6L, CONFIG7L
                    18F4220 CONFIG5L, CONFIG6L, CONFIG7L
                    18F2439 CONFIG5L, CONFIG6L, CONFIG7L
                    18F4439 CONFIG5L, CONFIG6L, CONFIG7L
                    18F2525 CONFIG5L, CONFIG6L, CONFIG7L
                    18F4525 CONFIG5L, CONFIG6L, CONFIG7L
                    18F6520 CONFIG2L, CONFIG2H, CONFIG3L, CONFIG3H, CONFIG5L,
                            CONFIG6L, CONFIG7L
                    18F6620 CONFIG3L, CONFIG5L, CONFIG6L, CONFIG7L
                    18F6720 CONFIG3L
                    18F8520 CONFIG2L, CONFIG2H, CONFIG3H, CONFIG5L, CONFIG6L,
                            CONFIG7L
                    18F8620 CONFIG5L, CONFIG6L, CONFIG7L

        18F2331 and 18F2431 had extra settings removed that are unimplemented on these devices as follows:
        CONFIG5L - Removed settings for CP2 and CP3.
        CONFIG6L - Removed settings for WRT2 and WRT3.
        CONFIG7L - Removed settings for EBTR2 and EBTR3.
        In addition, 18F2525, 18F2620, 18F4525 and 18F4620 had their value names modified in CONFIG2L for the BORV setting to be 3 (for Minimum setting), 2, 1, and 0 (for Maximum setting).
      (27518)
        SWDTEN bit should be 0th bit, but the bit location is 7 on 18F4321 family devices. For all devices, changed SWDTEN on SFR WDTCON from bit 7 to bit 0.
      (27519)
        18F4321 family device support changes needed to match the data sheet DS39689A.
        All devices:
        -----------
        Added SFR ECCP1DEL
        Added SFR HLVDCON
        Added missing bits 4 and 5 (TXCKP and RXDTP) to BAUDCON
        Added missing bits 6 and 7 (P1M0 and P1M1) to CCP1CON
        Added missing bit 2 (HLVDIP) to IPR2
        Added missing bit 2 (HLVDIE) to PIE2
        Added missing bit 2 (HLVDIF) to PIR2
        Added missing bits 0-4 (SP0, SP1, SP2, SP3, SP4) to STKPTR
        Added missing bits 1-5 (ADMSK1, ADMSK2, ADMSK3, ADMSK4, ADMSK5) in SSPCON2
        Changed CONFIG1H FSCM to FCMEN
        Changed CONFIG2L BORV settings to 3 (Minimum setting), 2, 1, and 0 (Maximum setting)
        Corrected CONFIG3H default settings
        Changed CONFIG3H LPT1OSC setting names from LOW and HIGH to ON and OFF to be consistent with other devices
        Changed CONFIG3H PBAD to PBADEN
        Corrected CONFIG4L default settings
        Updated Configuration descriptions to match data sheet
        18F2221/18F2321
        ---------------
        Removed ICPORT from CONFIG4L - unimplemented on these devices.
      (27612)
        18F4520 family device support changes needed to match the data sheet DS39631A.
        All devices
        -----------
        Updated Configuration descriptions to match data sheet
        Change CONFIG2L BORV settings to 3 (Minimum setting), 2, 1, and 0 (Maximum setting)
        18F4520
        -------
        Removed SFR EEADRH - unimplemented on this device
        18F4420
        -------
        Removed SFR DEBUG - unimplemented on this device
        Removed - SFR TRISE bits TRISE7, TRISE6, TRISE5, TRISE4 - not in data sheet
        Removed - SFR PORTB bits DAD5, DAD6, DAD7 - not in data sheet
        CONFIG3H - added missing setting for LPT1OSC
        CONFIG4L - changed setting name ENHCPU to XINST
        CONFIG5L, CONFIG6L, CONFIG7L - corrected default settings for unimplemented but maintained set bits
        18F2520
        -------
        Added missing SFRs PWM1CON and ECCP1AS
        Removed SFR EEADRH
        CONFIG3H - added missing setting for LPT1OSC
        CONFIG4L - changed setting name ENHCPU to XINST
        18F2420
        -------
        Removed SFR DEBUG - unimplemented on this device
        Added missing SFRs PWM1CON and ECCP1AS
        Removed - SFR PORTB bits DAD5, DAD6, DAD7 - not in data sheet
        CONFIG3H - added missing setting for LPT1OSC
        CONFIG4L - changed setting name ENHCPU to XINST
        CONFIG5L, CONFIG6L, CONFIG7L - corrected default settings for unimplemented but maintained set bits
      (27614)
        18F4550 family device support changes needed to match the data sheet DS39632B.
        All devices
        -----------
        Corrected bit positions of TUN3 and TUN4 in OSCTUNE
        UFRMH and UFRML - Add bit names to these register
        Updated Configuration descriptions to match the data sheet
        In CONFIG2L, changed BORV settings to 3 (Minimum setting), 2, 1, and 0 (Maximum setting)
        18F4550
        -------
        Added bits to CCP1DEL and CCP1AS.
        Corrected default values in CONFIG1L, CONFIG2L and CONFIG3H
        18F4455
        -------
        Added bits to CCP1DEL and CCP1AS
        Corrected default values in CONFIG1L, CONFIG2L and CONFIG3H
        Removed CP3 from CONFIG5L, WRT3 from CONFIG6L and EBTR3 from
        CONFIG7L - they are not available in this device
        18F2550
        -------
        Added ECCP1AS and ECCP1DEL and their bits
        Corrected default values in CONFIG1L, CONFIG2L and CONFIG3H
        Removed ICPRT from CONFIG4L - it is not available in this device
        18F2455
        -------
        Added ECCP1AS and ECCP1DEL and their bits
        Corrected default values in CONFIG1L, CONFIG2L and CONFIG3H
        Removed ICPRT from CONFIG4L, CP3 from CONFIG5L, WRT3 from CONFIG6L and EBTR3 from CONFIG7L - they are not available in this device
      (27615)
        18F8410 family device support changes needed to match the data sheet DS39635A.
        18F6310, 18F6410, 18F8310 and 18F8410
        -------------------------------------
        Removed EEIP from SFR IPR2 - unimplemented in data sheet
        Removed EEIE from SFR PIE2 - unimplemented in data sheet
        Removed EEIF from SFR PIR2 - unimplemented in data sheet
        Removed TUN5 from SFR OSCTUNE - unimplemented in data sheet
        Updated Configuration descriptions to match data sheet
        Changed CONFIG2L BORV settings to 3 (Minimum setting), 2, 1, and 0 (Maximum setting)
        CONFIG3H - corrected default settings for unimplemented but maintain set bits
        18F6310 and 18F6410
        -------------------
        CONFIG3L is unimplemented but to keep the default values set it has been added. No settings are available so it can not be changed
        Changed CONFIG3H PORTTBE setting to PORTE
        CONFIG7L is unimplemented for these devices but to keep the default values set it will remain but the EBTR setting is removed
      (27618)
        18F87J10 family device support changes needed to match the data sheet DS39663A.
        All devices
        -----------
        STKPTR - added bits SP4, SP3, SP2, SP1, SP0
        INTCON2 - added bit INT3IP
        ADCON0 - added bit ADCAL
        CCP1CON - added bits P1M1, P1M0
        CCP2CON - added bits P2M1, P2M0
        CCP3CON - added bits P3M1, P3M0
        ECCP1AS - added bits PSS1AC0, PSS1AC1, ECCP1AS0, ECCP1AS1, ECCP1AS2, ECCP1ASE
        EECON2 - added SFR
        EECON1 - added SFR and bits FREE, WRERR, WREN, WR
        OSCTUNE - corrected size of PLLEN
        BAUDCON1 - added bit RCIDL
        BAUDCON2 - added bit RCIDL
        ECCP1DEL - added bits P1DC0, P1DC1, P1DC2, P1DC3, P1DC4, P1DC5, P1DC6, P1RSEN
        ECCP3AS - added bits PSS3AC0, PSS3AC1, ECCP3AS0, ECCP3AS1, ECCP3AS2, ECCP3ASE
        ECCP3DEL - added bits P3DC0, P3DC1, P3DC2, P3DC3, P3DC4, P3DC5, P3DC6, P3RSEN
        ECCP2AS - added bits PSS2AC0, PSS2AC1, ECCP2AS0, ECCP2AS1, ECCP2AS2, ECCP2ASE
        ECCP3DEL - added bits P2DC0, P2DC1, P2DC2, P2DC3, P2DC4, P2DC5, P2DC6, P2RSEN
        CONFIG1H - correct default settings
        Updated configuration descriptions to match data sheet
        18F87J10/86J15/86J10/85J15/85J10
        --------------------------------
        ECCP1AS - added bits PSS1BD0, PSS1BD1
        PORTG - added bits RDPU, REPU, RJPU
        18F67J10/66J15/66J10/65J15/65J10
        --------------------------------
        Removed MEMCON - unimplemented on these devices
        PORTG - added bits RDPU, REPU
        Added CONFIG3L with no settings to maintain default values
        CONFIG3H - correct default settings
      (27621)
        18F4610 family device support changes needed to match the data sheet DS39636A.
        All devices
        -----------
        Updated Configuration descriptions to match data sheet
        Change CONFIG2L BORV settings to 3 (Minimum setting), 2, 1, and 0 (Maximum setting)
        18F4610
        -------
        CONFIG3H - added missing setting for LPT1OSC
        CONFIG4L - changed setting name ENHCPU to XINST
        18F4515
        -------
        CONFIG3H - added missing setting for LPT1OSC
        CONFIG4L - changed setting name ENHCPU to XINST
        CONFIG5L, CONFIG6L, CONFIG7L - corrected default settings
        18F4510
        -------
        CONFIG5H, CONFIG6H - corrected default settings
        18F4410
        -------
        CONFIG3H - added missing setting for LPT1OSC
        CONFIG4L - changed setting name ENHCPU to XINST
        CONFIG5L, CONFIG5H, CONFIG6L, CONFIG6H, CONFIG7L - corrected default settings
        18F2610
        -------
        CONFIG3H - added missing setting for LPT1OSC
        CONFIG4L - changed setting name ENHCPU to XINST
        18F2515
        -------
        CONFIG3H - added missing setting for LPT1OSC
        CONFIG4L - changed setting name ENHCPU to XINST
        CONFIG5L, CONFIG6L, CONFIG7L - corrected default settings
        18F2510
        -------
        CONFIG5H, CONFIG6H - corrected default settings
        18F2410
        -------
        CONFIG3H - added missing setting for LPT1OSC
        CONFIG4L - changed setting name ENHCPU to XINST
        CONFIG5L, CONFIG5H, CONFIG6L, CONFIG6H, CONFIG7L - corrected default settings
      (27622)
        18F44J10 family device support changes needed to match the data sheet DS39682A.
        All devices
        -----------
        Updated configuration descriptions
        18F45J10/18F44J10
        -----------------
        Added bit 7 - P1M1 and bit 6 - P1M0 to CCP1CON
      (27623)
        18F8722 family device support changes needed to match the data sheet DS39646B.
        All devices
        -----------
        Updated Configuration descriptions to match data sheet
        Change CONFIG2L BORV settings to 3 (Minimum setting), 2, 1, and 0 (Maximum setting)
        18F6527
        -------
        CONFIG3H - changed setting name PORTB to PORTE
        CONFIG5L, CONFIG6L, CONFIG7L - corrected default settings
        18F6622
        -------
        CONFIG3H - changed setting name PORTB to PORTE
        CONFIG5L, CONFIG6L, CONFIG7L - corrected default settings
        18F6627
        -------
        CONFIG3H - changed setting name PORTBE to PORTE
        CONFIG5L, CONFIG6L, CONFIG7L - corrected default settings
        18F6722
        -------
        CONFIG3H - changed setting name PORTBE to PORTE
        18F8527
        -------
        CONFIG3H - changed setting name PORTB to PORTBE
        CONFIG5L, CONFIG6L, CONFIG7L - corrected default settings
        18F8622
        -------
        CONFIG3H - changed setting name PORTB to PORTBE
        CONFIG5L, CONFIG6L, CONFIG7L - corrected default settings
        18F8627
        -------
        CONFIG5L, CONFIG6L, CONFIG7L - corrected default settings
      (27639)
        18F8490 family device support changes needed to match the data sheet DS39629B.
        18F6390, 18F6490, 18F8390 and 18F8490
        -------------------------------------
        Removed EEIP from SFR IPR2 - unimplemented in data sheet
        Removed EEIE from SFR PIE2 - unimplemented in data sheet
        Removed EEIF from SFR PIR2 - unimplemented in data sheet
        Removed TUN5 from SFR OSCTUNE - unimplemented in data sheet
        Updated Configuration descriptions to match data sheet
        Changed CONFIG2L BORV settings to 3 (Minimum setting), 2, 1, and 0 (Maximum setting)
        CONFIG3H - corrected default settings
        Removed CONFIG7L it is not implemented in these devices
      (27736)
        In previous releases, the MPLAB C18 installer could corrupt the PATH environment variable, causing variables within the PATH variable to not be expanded. Since the system variable SystemRoot is often part of several important PATH entries, many commands could not be found after this.
      (27737)
        Auto context saving was not saving locations when a TBLRD instruction was generated. For example, a CALL instruction followed by a MOVF where the 'd' bit was not set would cause the location to not be saved.

5. # Devices Supported

   The MPLAB C18 C compiler (MCC18.EXE) is an ANSI C compiler for the PIC18 family of PIC microcontrollers. It currently supports the following PIC MCUs:

       PIC18C242+      PIC18C252+      PIC18C442+      PIC18C452+
       PIC18C601+      PIC18C658+      PIC18C801+      PIC18C858+

       PIC18F1220+     PIC18F1230      PIC18F1231      PIC18F1320+
       PIC18F1330      PIC18F1331      PIC18F2220+     PIC18F2221
       PIC18F2320+     PIC18F2321      PIC18F2331+     PIC18F2410+
       PIC18F242+      PIC18F2420+     PIC18F2423      PIC18F2431+
       PIC18F2439+     PIC18F2450      PIC18F2455+     PIC18F2458*
       PIC18F248+      PIC18F2480+     PIC18F24J10+    PIC18F24K20
       PIC18F2510+     PIC18F2515+     PIC18F252+      PIC18F2520+
       PIC18F2523      PIC18F2525+     PIC18F2539+     PIC18F2550+
       PIC18F2553*     PIC18F258+      PIC18F2580+     PIC18F2585+
       PIC18F25J10+    PIC18F25K20     PIC18F2610+     PIC18F2620+
       PIC18F2680+     PIC18F2682      PIC18F2685      PIC18F4220+
       PIC18F4221      PIC18F4320+     PIC18F4321      PIC18F4331+
       PIC18F4410+     PIC18F442+      PIC18F4420+     PIC18F4423
       PIC18F4431+     PIC18F4439+     PIC18F4450      PIC18F4455+
       PIC18F4458*     PIC18F448+      PIC18F4480+     PIC18F44J10+
       PIC18F44K20     PIC18F4510+     PIC18F4515+     PIC18F452+
       PIC18F4520+     PIC18F4523      PIC18F4525+     PIC18F4539+
       PIC18F4550+     PIC18F4553*     PIC18F458+      PIC18F4580+
       PIC18F4585+     PIC18F45J10+    PIC18F45K20     PIC18F4610+
       PIC18F4620+     PIC18F4680+     PIC18F4682      PIC18F4685
       PIC18F6310+     PIC18F6390+     PIC18F63J11     PIC18F63J90
       PIC18F6410+     PIC18F6490+     PIC18F64J11     PIC18F64J15
       PIC18F64J90     PIC18F6520+     PIC18F6525+     PIC18F6527+
       PIC18F6585+     PIC18F65J10+    PIC18F65J11     PIC18F65J15+
       PIC18F65J50     PIC18F65J90     PIC18F6620+     PIC18F6621+
       PIC18F6622+     PIC18F6627+     PIC18F6680+     PIC18F66J10+
       PIC18F66J11     PIC18F66J15+    PIC18F66J16     PIC18F66J50
       PIC18F66J55     PIC18F66J60     PIC18F66J65     PIC18F6720+
       PIC18F6722+     PIC18F67J10+    PIC18F67J11     PIC18F67J50
       PIC18F67J60     PIC18F8310+     PIC18F8390+     PIC18F83J11
       PIC18F83J90     PIC18F8410+     PIC18F8490+     PIC18F84J11
       PIC18F84J15     PIC18F84J90     PIC18F8520+     PIC18F8525+
       PIC18F8527+     PIC18F8585+     PIC18F85J10+    PIC18F85J11
       PIC18F85J15+    PIC18F85J50     PIC18F85J90     PIC18F8620+
       PIC18F8621+     PIC18F8622+     PIC18F8627+     PIC18F8680+
       PIC18F86J10+    PIC18F86J11     PIC18F86J15+    PIC18F86J16
       PIC18F86J50     PIC18F86J55     PIC18F86J60     PIC18F86J65
       PIC18F8720+     PIC18F8722+     PIC18F87J10+    PIC18F87J11
       PIC18F87J50     PIC18F87J60     PIC18F96J60     PIC18F96J65
       PIC18F97J60

   *Note: Early adopter support has been added for these devices since last release

   +Note: These are the only PIC18 devices with peripheral library support.

   THE PARTS LISTED ABOVE MAY NOT ALL BE COMMERCIALLY AVAILABLE.

6. # MPLAB C18 C Compiler Documentation

   The following document revisions are associated with this release:

   - MPLAB C18 C Compiler Getting Started (DS51295 revision F)
   - MPLAB C18 C Compiler User's Guide (DS51288 revision J)
   - MPLAB C18 C Compiler Libraries (DS51297 revision F)

   If the installation includes documentation, the files listed above are placed in the <install_dir>\doc directory.

   The current documentation is available from our web site: http://www.microchip.com/c18

   The following Help files are associated with this release and can be found in the <install_dir>\doc directory.:

   - PIC18 Configuration Settings Help (Updated January 10, 2006)
   - COFF File Format Help (Updated January 10, 2006)
   - MPLAB C18 C Compiler User's Guide Help (Updated January 10, 2006)

7. # Documentation Update

   The information in the COFF File Format Help file (Updated January 10, 2006) supercedes the information found in Appendix A, COFF File Format, Table A-2 of the document:
   MPLAB C18 C Compiler User's Guide (DS51288 revision J)

   The information in the PIC18 Configuration Settings Help file (Updated January 10, 2006) supercedes the information found in the document:
   PIC18 Configuration Settings Addendum (DS51537 revision F)

8. # Installation

   MPLAB C18 requires the use of MPLINK™, Microchip's object linker; MPLAB C18 v3.00 or later will require MPLINK v4.00 or later. The latest version of MPLINK is included with the installation.

   To verify correct installation of MPLAB C18, execute the batch file <install_dir>\example\an696\buildit.bat. If the compiler system has been installed correctly, the file 18motor.out will be created.

   When installing MPLAB C18, the setup program offers the user the ability to change several environment settings. The following options are provided:

   Environment Variables:

   - Add MPLAB C18 to PATH environment variable
     The directory of the compiler executables is added to the beginning of the current PATH environment variable.
   - Add MPASM to PATH environment variable
     The directory of the MPASM executable is added to the beginning of the current PATH environment variable.
   - Add header file path to MCC_INCLUDE environment variable
     The location of the header (.h) files is added to the beginning of the user's MCC_INCLUDE environment variable. MPLAB C18 uses this setting to search for header files.
   - Modify PATH and MCC_INCLUDE variables for all users
     The options listed above are applied to the machine environment variables instead of the user environment variables, so that they affect all users and not just the current user.
     This option only appears if the user running the installer has administrative rights.

   MPLAB IDE Configuration:
   The options below only appear if the user has a version of MPLAB IDE installed.

   - Update MPLAB IDE to use this MPLAB C18
     Configuration settings used by the MPLAB IDE to find MPLAB C18 will be updated to indicate the location of this release.
   - Update MPLAB IDE to use this MPLINK, MPLIB, and MPASM
     Settings used by MPLAB IDE to find the MPLINK Linker, MPLIB Librarian, and MPASM Assembler will be updated to point to those in this release.
   - Update MPLAB IDE Help with MPLAB C18 documentation
     Documentation installed with MPLAB C18 will be made available from the Help menu of the MPLAB IDE.
     This option only appears if documentation is being installed.
   - Perform MPLAB IDE updates for all users
     The changes to the MPLAB IDE configuration are applied to the machine registry instead of that of the current user, so that they affect all users and not just the current user.
     This option only appears if the user running the installer has administrative rights.

   If MPLAB C18 is uninstalled, these changes to the IDE configuration will not be rolled back.

9. # Using MPLAB C18 with the MPLAB IDE

   See the document "MPLAB C18 C Compiler Getting Started Guide" for a step-by-step tutorial on using MPLAB C18 with the MPLAB IDE.

   The current documentation is available from our web site, http://www.microchip.com/c18

   NOTE: MPLAB C18 v3.00 and later will not be compatible with versions of the MPLAB IDE prior to v7.21.

10. # Known Problems

    The following are some of the known issues with MPLAB C18 v3.10. The first list presented, SSR SUMMARY, is a brief summary of each SSR, System Service Request, for ease of reference. For more details on an SSR, see that SSR in the list SSR DETAILS which follows.

    ## SSR SUMMARY

    ## General

    (29230)
      The "exclusive or" assignment operator may not work correctly in expressions where the compiler cannot determine the bit field address during compile.
    (29304)
      Variables declared with volatile or const qualifiers suppress any qualifier mismatch warnings.
    (28372)
      The strchrpgm() function may not return a value.
    (27011)
      No error message generated for run time assignment to a const struct.
    (27683)
      #pragma sectiontype does not throw an error on inappropriate arguments and does not create the named section.
    (23897)
      integer *= float-constant casts constant to integer before multiplication.
    (24130)
      A conflicting redefinition of type does not cause error or warning.
    (24481)
      Due to a COFF limitation, a greater than 16-bit relocation offset is calculated incorrectly at link-time.
    (25512)
      Mismatch in config values for BORV across many device families.
    (20189)
      (non-extended mode only) Passing a static parameter to a function pointer in a structure should generate an error message, but instead generates an internal compiler error.
    (20975)
      With integer promotions enabled, if the left operand of the >>= operator is negative, the result stored in the operand is incorrect.
    (21192)
      (non-extended mode only) The result of the %= operator where the left operand is a 24-bit or 32-bit rom variable is incorrect.
    (21261)
      (non-extended mode only) Calling a function pointer which has been converted from an object pointer generates an internal compiler error.
    (21693)
      Redefinitions of structure tags in nested scopes are not observed properly by MPLAB C18.
    (21634 / 23024)
      The assignment of the address of an object in constant program memory to a pointer to non-constant data memory does not generate a diagnostic.
    (23183)
      When the conditional (?:) operator is used with operands which are greater than 32 bits in size, an "irreducible tree" internal error may be generated.
    (21349 / 23238)
      Referencing a variable declared 'extern' with an initializer causes an internal failure.
    (18487)
      With the compound assignment operators, the usual type conversions which are to be performed on the operands are not done correctly when the left operand is 8 bits in size.
    (20359)
      There is a bug in the implementation of the scoping of typedef names.
    (22091)
      String literals are placed in program memory and so must be assigned to variables of type 'rom char *'. However, assigning one to a pointer to data memory does not generate a diagnostic.
    (22147)
      Octal constants which contain an '8' or '9' do not generate a diagnostic. Instead, the code compiles quietly, and the value used for the constant is indeterminate.
    (22768)
      The redeclaration of a structure tag should generate an error, but does not.
    (22784)
      A local variable declared 'rom' and 'extern' is disallowed when it should be permitted.
    (21514 / 22953)
      (non-extended mode only) Using static parameters with a function which has a variable number of arguments is not supported, but does not generate a compile time error.
    (26056)
      Unable to reduce tree for: if (local char * > parameter const rom far char * + constant)
    (27455)
      The volatile qualifier is not applied to struct members.
    (22483)
      MPLIB is unable to work with MPLAB C18 files compiled in the static overlay model.

    ## Inline Assembly

    (21443)
      Compiler crashes on invalid inline assembly code.
    (22557)
      In some cases, using a valid cast expression in inline assembly can cause a crash.
    (22170 / 22632)
      Incorrect use of automatic local variables in inline assembly code does not generate a warning or error.
    (22559)
      Enumeration constants in expressions which are operands of inline assembly instructions can cause an internal error to be generated.

    ## Preprocessor

    (21817)
      Preprocessor merging operator should take precedence over the stringization operator
    (23817)
      The preprocessor performs macro replacement within the text of a #error directive.
    (23827)
      Crash (after error message) for #elif with no preceding #if
    (23717 / 23844)
      Comments in a macro call may cause incorrect substitution or a syntax error.
    (24038)
      No error when #if does not have corresponding #endif and condition is true
    (25409)
      Preprocessor evaluates expressions in discarded lines of an #ifdef expression.
    (22522)
      The preprocessor may go into an infinite loop when expanding mutually recursive macros.
    (21252 / 25868)
      A macro invocation spanning more than one logical source file line may throw off line number information or cause the preprocessor to not output a line number, causing debugging difficulty in the MPLAB IDE.
    (26031)
      The preprocessor performs macro replacement inside a #pragma directive.
    (26397)
      A constant string ending with \\" causes any following text on the line to be treated as part of the string.
    (26385)
      The preprocessor does not throw an error on finding "#elsif"
    (25733)
      Using absolute path in "#include" directive causes compiler to put invalid file path in COFF file and error messages
    (27540)
      A malformed expression in a #if preprocessor directive on the last line of a file with no terminating end of line character may cause the preprocessor to crash.
    (27541)
      #undef on the last line of a source file with no terminating end of line may cause the preprocessor to crash.
    (28101)
      Circular or recursive macro defnitions can cause the preprocessor to take up all available CPU cycles and hang for a long time before giving an error.

    ## Libraries

    Note: From the release of MPLAB C18 v2.42 onward, no support has been added to the peripheral libraries.
    (18624)
      The library routine 'atof' generates a result less precise than simply assigning a constant.
    (23497)
      Timer5, SPI, and I2C peripherals not implemented for 18F2331, 18F2431, 18F4331, and 18F4431; nor is the enhanced facility (function baudUSART) implemented for these devices.
    (26882)
      Library c018iz.o does not zero bank 15 at startup.

    ## Header Files

    None.

    ## User Error Screening

    (26595)
      Utilizing an enumerated type for a bitfield does not issue an error diagnostic.

    ## SSR DETAILS

    ## General

    (29230)
    The "exclusive or" assignment operator may not work correctly in expressions where the compiler cannot determine the bit field address during compile.
    For example, for the code:

          struct {
            unsigned b0:1;
            unsigned b1:1;
            unsigned b2:1;
            unsigned b3:1;
            unsigned b4:1;
            unsigned b5:1;
            unsigned b6:1;
            unsigned b7:1;
          }b[2];

          void main(void){
            char a=1;
            b[a].b1^=1;
          }

    Executing this code, the value b[a].b1 should toggle each time through main, but the value does not change.
    A workaround is to use the XOR operator explicitly.
    In the above example, using:

            b[a].b1=b[a].b1^1;

    would work as desired.
    (29304)
    Variables declared with volatile or const qualifiers suppress any qualifier mismatch warnings.
    For example:

          typedef char * cPtr_t;
          volatile cPtr_t rom rompc;
          volatile rom char romc;
          void f(void)
          {
            rompc = &romc; /*warning is supressed here*/
          }

    In this code, romc is in rom but rompc points to ram so a qualifier mismatch exists.
    (28372)
    The strchrpgm() function may not return a value.
    In the example code below the strchrpgm() function does not return a value to the rptr variable. Running the code in a debugger/simulator, you can see that it executes properly in that it breaks after a match with TBLPTR containing the correct address. But it does not return the address to the rptr variable.
    Built using " -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-"

          #include <string.h>

          // global vars
          #pragma romdata
          const far rom char rarray[]="12345";

          #pragma udata
          far rom char* rptr;

          // code
          #pragma code

          void main()
          {
              Nop();
              rptr = strchrpgm(rarray, 0x32);
              Nop();

              for(;;)
              {
                // infinite loop
              }
          }

    (27011)
    No error message generated for run time assignment to a const struct.
    For example, the code:

          typedef struct
          {
                  int b;
          } typeB;

          const typeB objB;

          void fB_type( )
          {
                  objB.b = 1;
          }

    does not generate an error.
    (27683)
    #pragma sectiontype does not throw an error on inappropriate arguments and does not create the named section.
    For example, the code:

          #pragma romdata whatever =
          const rom unsigned char = 0x71;
          #pragma romdata

    does not generate an error and does not create a section named whatever.
    (23897)
    integer *= float-constant casts constant to integer before multiplication.
    For example:

          volatile unsigned char uc_test;
          uc_test = 80;
          uc_test *= 0.7; /* Expected: 56, Actual: 0*/

    A workaround to this is to write the last statement as:

          uc_test = uc_test * 0.7;

    (24130)
    Conflicting redefinition of type does not cause error or warning.
    For example:

          typedef unsigned short long foo;
          typedef unsigned char foo;
          typedef unsigned short foo;
          typedef unsigned int foo;
          typedef unsigned long foo;
          typedef double foo;
          typedef long double foo;
          typedef struct
          {
            ...
          } foo;
          typedef union foo
          {
            ...
          } foo;

    It should cause the compiler to emit errors such as:

          test.c:3: error: conflicting types for `foo'
          test.c:2: error: previous declaration of `foo'

    (24481)
    Due to a COFF limitation, a greater than 16-bit relocation offset is calculated incorrectly at link-time.
    Microchip's Common Object File Format (COFF) contains a limitation in the relocation entry, which is the structure that implements the dynamics of relocation. In Microchip's COFF, the offset to add to the base address of the symbol is stored in the relocation entry. This differs from the System V relocation data in which the offset is stored in the location being relocated to. This difference is necessary because Microchip relocations are not restricted to just filling in an address + offset value into the data stream, but also to do simple code modifications. The limitation comes from the fact that this offset is defined as a short, which dictates that offsets may be no larger than 16-bit.
    The following example shows the side effect of this limitation:

          #pragma romdata constscn=0x2000
          rom const unsigned char var;
          #pragma romdata

          rom const unsigned char *varptr = &var + 0x8000;

    The above code gives the following relocation entries:

         Relocation: r_vaddr=0x00000000, r_symndx=2, r_offset=-32768, r_type=4
         Relocation: r_vaddr=0x00000001, r_symndx=2, r_offset=-32768, r_type=3
         Relocation: r_vaddr=0x00000002, r_symndx=2, r_offset=-32768, r_type=21

    Note that the r_offset field reflects an offset of -32k instead of +32k.
    A workaround is to use code for which the compiler will evaluate the offset at run-time.
    For example:

          void foo( void )
          {
            varptr = &var;
            varptr += 0x8000;
          }

    (25512)
    Mismatch in config values for BORV across many device families.
    For example, on the data sheet for the PIC18F8410 family, the BORV values are 2.1, 2.8, 4.3, 4.6
    But the equivalent values in the MPLAB C18 compiler are 25, 27, 42, 45.
    (20189) (non-extended mode only)
    Passing a static parameter to a function pointer in a structure should generate an error message, but instead generates an internal compiler error.
    For example:

          struct { void (*f) (static int x); } S;
          void main (void) { S.f (1); }

    (20975)
    With integer promotions enabled, if the left operand of the >>= operator is negative, the result stored in the operand is incorrect.
    For example, 'x' should be end up with -1, but instead ends up with 1:

          signed char x;
          x = 0x80;
          x >>= 7; /* 'x' should be -1, but is 1 instead */

    The integer promotions are not performed on 'x'.
    (21192) (non-extended mode only)
    The result of the %= operator where the left operand is a 24-bit or 32-bit rom variable is incorrect. For example:

          rom short long x;
          void main (void)
          {
            short long y;
            x = 1025;
            y = x %= 2; /* 'x' correctly receives 1, but 'y' does not */
            ...

    (21261) (non-extended mode only)
    Calling a function pointer which has been converted from an object pointer generates an internal compiler error. For example:

          unsigned long x[4];
          void main (void) { ((void (*)(void))x)( ); }

    (21693)
    Redefinitions of structure tags in nested scopes are not observed properly by MPLAB C18. For example:

          struct s { int x; } S;
          void main (void)
          {
            struct s; /* this introduces a new type, hiding the previous */
            struct s *Sp = &S; /* this is an incompatible assignment */
            Sp->x++;  /* invalid access of an incomplete type */
            ...

    The inner declaration of 'struct s' introduces a new (incomplete) type, which is different than the first 'struct s'. However, the above program compiles quietly. The structure tag is not redefined.
    (21634 / 23024)
    The assignment of the address of an object in constant program memory to a pointer to non-constant data memory does not generate a diagnostic. For example:

          const rom char x;
          char *p;
          void main (void) { p = &x; ... }

    A diagnostic should be generated. The effect of referencing through 'p' following the assignment is indeterminate.
    (23183)
    When the conditional (?:) operator is used with operands which are greater than 32 bits in size, an "irreducible tree" internal error may be generated. For example:

          struct s
          {
            unsigned long x;
            char y;
          } S, T;

          void main (void)
          {
            char b;
            unsigned long z;

            ...
            z = (b ? S : T).x;
            ...

    generates such an error. The workaround is to use an 'if' statement instead of the conditional operator.
    (21349 / 23238)
    Referencing a variable declared 'extern' with an initializer causes an internal failure. For example:

          extern int x = 5;
          void main (void) { x++; }

    generates an internal error. The workaround is to remove the 'extern' storage class specification or remove the initializer.
    (18487)
    With the compound assignment operators, the usual type conversions which are to be performed on the operands are not done correctly when the left operand is 8 bits in size. This can cause problems in these instances:
    -- With integer promotions enabled, the compound assignment division operator may return incorrect results on 8-bit operands when the left operand is signed and the right is unsigned. The workaround is to replace:

          signed char x;
          unsigned char y;
          ...
          x /= y;

    with:

          signed char x;
          unsigned char y;
          ...
          x = x / y;

    -- The compound assignment remainder operator may return incorrect results when the right operand is greater than 8 bits in size. The workaround is to replace

          unsigned char x;
          unsigned short y;
          ...
          x %= y;

    with:

          unsigned char x;
          unsigned short y;
          ...
          x = x % y;

    (20359)
    There is a bug in the implementation of the scoping of typedef names.
    The following example generates a syntax error:

          void main (void)
          {
            typedef int X;
            {
              struct Y { int X; };
              (X)3; /* this should refer to the typedef name,
                     * not the structure member */
            }
          }

    The textually intervening declaration of 'X' as a structure member causes the typedef declaration of 'X' to be lost.
    (22091)
    String literals are placed in program memory and so must be assigned to variables of type 'rom char *'. However, assigning one to a pointer to data memory does not generate a diagnostic. For example:

          char *s = "hello world";

    Any references through 's' will result in indeterminate behavior.
    (22147)
    Octal constants which contain an '8' or '9' do not generate a diagnostic. Instead, the code compiles quietly, and the value used for the constant is indeterminate.
    (22768)
    The redeclaration of a structure tag should generate an error, but does not. For example:

          struct foo { int a; };
          struct foo { char b; };

          struct foo F;

    compiles quietly without error. The variable 'F' takes on the type of the second declaration.
    (22784)
    A local variable declared 'rom' and 'extern' is disallowed when it should be permitted. The error messages generated incorrectly refer to the declaration as 'auto'. For example:

          void main (void) { extern rom int x; }

          Error: local 'x' in program memory can not be 'auto'

    (21514 / 22953) (non-extended mode only)
    Using static parameters with a function which has a variable number of arguments is not supported, but does not generate a compile time error. Instead, a link time error is emitted which may not be comprehensible:

          Error - could not find definition of symbol '_foo:101' ...

    Such would be the error message if the function in question is called 'foo'.
    (26056)
    Unable to reduce tree for if (local char * > parameter const rom far char * + constant)
    For both extended and non-extended modes, the following function:

          void foo(const rom far char * FullPath, char *Path, char *FileName)
          {
            char *NameStart;
            char *s;

            if ((NameStart > FullPath + 1) && (*(Path - 1) == '\\'))
              return;
          }

    results in:

          Fatal [100] - internal - unable to reduce tree

    The problem is caused by comparing the address of a pointer located on the stack (i.e. ram) with one located in rom. This is not a valid comparison and should result in an error.
    (27455)
    The volatile qualifier is not applied to struct members.
    For the following source code:

          struct
            {
              unsigned char aaa;
              volatile unsigned char bbb;
            } flags;

    the volatile qualifier on the second member of the struct 'flags' is ignored.
    Workaround:
    Apply the volatile qualifier to the entire struct.

          struct
            {
              unsigned char aaa;
              volatile unsigned char bbb;
            } volatile flags;

    (22483)
    MPLIB is unable to work with MPLAB C18 files compiled in the static overlay model.
    For example:

          int add( int a, int b )
          {
            int c;
            c = a + b;
            return c;
          }

    Compiled with:

          mcc18 test.c -sco

    Then placed in an archive containing only this file:

          mplib -c test.lib test.o

    MPLIB is unable to list the files in the archive.

          mplib -t test.lib

    Gives the error:

          Error - Coff file 'test.o' could not read string table.
          Error - Could not build member 'test.o' in library file 'test.lib'.

    Trying to use such an archive with MPLINK also gives an error saying it could not read the string table.

    ## Inline Assembly

    (21443)
    Compiler crashes on invalid inline assembly code.
    For example:

          void foo(unsigned short addr)
          {
            _asm
            movff ((unsigned char *)&addr)+1,1
            _endasm
          }

    The workaround is to use valid inline assembly syntax:

          movff addr+1,1

    (22557)
    In some cases, using a valid cast expression in inline assembly can cause a crash:

          void main (void)
          {
            static char x;
            _asm
              movff x, x + (unsigned char)1
            _endasm
          }

    The workaround is to remove the cast.
    (22170 / 22632)
    Incorrect use of automatic local variables in inline assembly code does not generate a warning or error.
    Automatic local variables, when used in inline assembly expressions, are given a value which is their offset from the frame pointer.
    For example, the following code demonstrates the proper accessing of stack-based variable 'a' using its value in PLUSW2 addressing.
    It then demonstrates improper accessing of stack variable 'b' by attempting to reference it using direct mode addressing.

          #include <p18f452.h>

          void assignlocals( void )
          {
            auto char a, b;

            _asm

            // correctly assigns TMR0L to variable 'a'
            movlw a
            movff TMR0L, PLUSW2

            // DOES NOT correctly assign TMR0L to variable 'b'
            movff TMR0L, b

            _endasm
          }

    The compiler should give an error (or at least a warning) on the use of variable 'b' in a direct mode addressing instruction, but it instead generates code as if the offset were an absolute address.
    (22559)
    Enumeration constants in expressions which are operands of inline assembly instructions can cause an internal error to be generated.
    The workaround is to use integer constants instead.

    ## Preprocessor

    (21817)
    Preprocessor merging operator should take precedence over the stringization operator.
    For example:

          #define STR(a) NXSTR(a)
          #define NXSTR(a) #a

          void
          foo (void)
          {
            // Apply "merging" operator
             #define CAT(a, b) NXCAT(a, b)
             #define NXCAT(a, b) a ## b

            // The two tokens '1.' and 'E9' should be merged into a single token
            // before the stringization operator is applied.
             STR(CAT (1., E9));
          }

    Preprocesses to:

          "CAT (1., E9)" ;

    but it should produce:

          "1.E9" ;

    (23817)
    The preprocessor performs macro replacement within the text of a #error directive.
    Example source code:

          #define FOSC 1800
          #error "FOSC is 1800"

    Preprocessor command line:

          cpp18 preproc-1.c

    Preprocessor output:

          #line 1 "preproc-1.c"
          #line 2 "preproc-1.c"
          preproc-1.c:2: "1800 is 1800"

    (23827)
    Crash (after error message) for #elif with no preceding #if For example:

          ...
          /* no #if here */
          #elif defined (_FOO_)
          #endif

    (23717 / 23844)
    Comments in a macro call may cause incorrect substitution or a syntax error.
    For example:

          #pragma romdata CONFIG
          _CONFIG_DECL (_OSCS_OFF_1H & _OSC_HSPLL_1H, // comments
          _PWRT_ON_2L & _BOR_OFF_2L & _BORV_42_2L,
          // comments
          0,
          _CCP2MUX_OFF_3H,
          ...

    Another example:
    A comment following the last argument in a macro invocation may cause a syntax error. For example:

          #include <p18f8720.h>
          #pragma romdata CONFIG
          _CONFIG_DECL
              (_CONFIG1H_DEFAULT,
               _CONFIG2L_DEFAULT,
               _CONFIG2H_DEFAULT,
               _CONFIG3L_DEFAULT,
               _CONFIG3H_DEFAULT,
               _CONFIG4L_DEFAULT,
               _CONFIG5L_DEFAULT,
               _CONFIG5H_DEFAULT,
               _CONFIG6L_DEFAULT,
               _CONFIG6H_DEFAULT,
               _CONFIG7L_DEFAULT,
               _CONFIG7H_DEFAULT //12
              );
          #pragma romdata

    The workaround is to not have comments inside a macro call.
    (24038)
    No error is given when #if does not have corresponding #endif and the condition is true
    For example:
    This gives a syntax error:

          #if defined(x)
          int y = x;

    But this does not:

          #define x 2
          #if defined(x)
          int y = x;

    Both should give syntax errors since the #endif is missing.
    (25409)
    Preprocessor evaluates expressions in discarded lines of an #ifdef expression.
    For example:

          #ifdef foo
          #if 12/foo
          #endif
          #endif
          ...

    Will generate a divide by zero error from the preprocessor, but should not since the expression shouldn't be evaluated.
    (22522)
    The preprocessor may go into an infinite loop when expanding mutually recursive macros.
    For example:

          #define x (4 + y)
          #define y (2 * x)
          void main (void) { y; }

    causes the preprocessor to run indefinitely.
    (21252 / 25868)
    A macro invocation spanning more than one logical source file line may throw off line number information, or cause the preprocessor to not output a line number, causing debugging difficulty in the MPLAB IDE.
    For example:

          void main (void)
          {
            int x;

            f (arg1,
               arg2,
               arg3); // macro call
            ...
            x++;      // breakpoint may not function correctly here
            ...

    A breakpoint set on a line following such a macro call may not work correctly. MPLAB IDE may state that such a breakpoint cannot be set.
    Additionally, stepping through the source code may not follow the expected sequence of execution. The workaround is to use the line splice character after each macro argument:

          void main (void)
          {
            int x;

            f (arg1,\
               arg2,\
               arg3);
            ...
            x++;

    (26031)
    The preprocessor performs macro replacement inside a #pragma directive.
    Macro replacement is performed inside any #pragma directive.
    The following code results in

          Error [1225] configuration value '0' not recognized for configuration setting 'WDT'

          #define OFF 0
          #define ON 1

          #pragma config WDT = OFF
          ....

    Workarounds:
      1) Move #pragma config to a separate .c source file with no #define or #include directives.
      2) Move #pragma config prior to any #define or #include directives.
    (26397)
    A constant string ending with \\" causes any following text on the line to be treated as part of the string
    The following code:

          char test[]="\\"; // "string"

    preprocessed with:

          mcc18 preproc.c -e

    results in:

          #line 1 "preproc.c"
           char test[]="\\"; // "string"

    Notice that the preprocessor does not remove the comment.
    (26385)
    The preprocessor does not throw an error on finding "#elsif"
    The following code:

          #define _BAR_

          #if defined(_FOO_)
            #error "_FOO_ defined"
          #elsif defined(_BAR_)
            #error "_BAR_ defined"
          #else
            #error "Neither defined"
          #endif

    will print "Neither defined" since "#elsif" is not a valid preprocessor directive. Although it should be "#elif" no error or warning is given about the typo.
    (25733)
    Using the absolute path in a "#include" directive causes the compiler to use an invalid filepath in the COFF file and error messages.
    Example source file:

          #include "c:\test\c18\include\header.h"
          void main (void)
          {}

    compiled with --

          c:\test\c18\include>mcc18 includepath.c

    causes the following path in the COFF file --

          C:\test\c18\include\c:\test\c18\include\header.h

    The path appears to be the included file's absolute path appended to the current working directory.
    and if the included file contains an error, the error messages show --

          C:\test\c18\include\c:\test\c18\include\header.h:1:Error: syntax error

    (27540)
    A malformed expression in a #if preprocessor directive on the last line of a file with no terminating end of line character may cause the preprocessor to crash.
    For example:

          #define symbol
          #if symbol /* end of file */

    causes the preprocessor to crash.
    Workaround: Terminate the source file by adding a blank last line.
    The preprocessor will display an error without crashing.
    (27541)
    #undef on the last line of a source file with no terminating end of line character may cause the preprocessor to crash.
    The following source file:

          #include <p18cxxx.h>

          void  main(void)
          {
             while(1);
          }

          #undef  SOME_LABEL /* end of file */

    causes the preprocessor to crash.
    Workaround: Terminate the source file by adding a blank last line.
    (28101)
    Circular or recursive macro defnitions can cause the preprocessor to take up all available CPU cycles and hang for a long time before giving an error.
    For example, the following code:

          void main(void)
          {
            #define f g
            #define g f
            f(1);
          }

    causes the preprocessor to hang for a long time, then give an error similar to:

          Preprocessor Error : out of dynamic memory in yy_scan_buffer

    ## Libraries

    Note: From the release of MPLAB C18 v2.42 onward, no support has been added to the peripheral libraries.
    (18624)
    The library routine 'atof' generates a result less precise than simply assigning a constant. For example:

          float a, c;
          char b[] = ".15625";
          void main ( )
          {
            a = atof (b);
            c = .15625;
          }

    The representation of 'c' is 0x7c200000 and 'a' is 0x7c1fffff.
    (23497)
    Timer5, SPI, and I2C peripherals not implemented for 18F2331, 18F2431, 18F4331, and 18F4431; nor is the enhanced facility (function baudUSART) implemented for these devices.
    The peripheral libraries do not currently support these peripherals on these devices.
    (26882)
    Library c018iz.o does not zero bank 15 at startup.
    Workarounds:
      Modify the startup code to point FSR0 to the highest general purpose RAM location.
      Specifically zero the variables located in bank 15.

    ## Header Files

    None.

    ## User Error Screening

    (26595)
    Utilizing an enumerated type for a bitfield does not cause an error diagnostic to be issued.
    The following code does not issue an error diagnostic:

          enum test_enum {alphavar, betavar, gammavar, deltavar = 5, epsilonvar};
          typedef struct {
            enum test_enum S_FH_FT : 3;
          } _c_LsFH_FT_1_msgType;

11. # Contributors

    Microchip gratefully acknowledges the contributions of the following to the development of MPLAB C18.

    Daniel Madill, Quanser Consulting --
    December 2000, Optimizations to fixed point divide library routines.

12. # Customer Support

    Microchip provides online support via our home page at:
    http://www.microchip.com
    Technical support is available through the web site at:
    http://support.microchip.com
    A forum for discussion of Microchip products and tools is available at:
    http://forum.microchip.com