Hot!Bug in XC8 compiler??

Author
ei69jeff
New Member
  • Total Posts : 7
  • Reward points : 0
  • Joined: 2017/11/01 08:02:04
  • Location: 0
  • Status: offline
2017/11/14 14:19:35 (permalink)
0

Bug in XC8 compiler??

I discovered that in this piece of code:
   1)  TRISB = 0x80;           //b7 input
    2)  TRISBbits.TRISB7 = 1    //b7 input
    3)  INTCONbits.INTF = 0;        //reset the external interrupt flag
    4)  INTCONbits.RBIF = 0;         //reset the interrupt ON CHANGE flag


Line 1 and 2 both set the same bit but when you compile this code, the compiles no longer understands the notation in line 3 and 4 and the compile fails.
If you remove or comment out line 2, the program compiles successfully. This makes no sense but I have seen other places where the XC8 compiler does not recognize the notation "INTCONbits.RBIF"
 
Does anyone know why or how to avoid this odd behavior?
#1

5 Replies Related Threads

    KTrenholm
    Super Member
    • Total Posts : 288
    • Reward points : 0
    • Joined: 2012/08/08 14:04:23
    • Location: Connecticut, USA
    • Status: offline
    Re: Bug in XC8 compiler?? 2017/11/14 14:24:03 (permalink)
    +6 (6)
    You're missing a semicolon after line 2.
     
    If you're seeing INTCONbits.RBIF not being recognized elsewhere, make sure xc.h is included for that source file, I think that's where the ***bits structures are defined.
    post edited by KTrenholm - 2017/11/14 14:28:24
    #2
    qhb
    Superb Member
    • Total Posts : 6258
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Bug in XC8 compiler?? 2017/11/14 18:34:52 (permalink)
    +3 (3)
    +1.
    Whenever you have a strange error in C, have a close look at the line above!
     
    #3
    ei69jeff
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2017/11/01 08:02:04
    • Location: 0
    • Status: offline
    Re: Bug in XC8 compiler?? 2017/11/15 05:55:58 (permalink)
    0
    Thanks, that fixed it.
    #4
    jtemples
    Super Member
    • Total Posts : 10423
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: Bug in XC8 compiler?? 2017/11/15 10:25:35 (permalink)
    +2 (2)
    Another nasty XC8 compiler bug squashed...
    #5
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 1684
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: Bug in XC8 compiler?? 2017/11/15 10:28:15 (permalink)
    +1 (1)
    1 sets all the bits.  May cause problems later
    2 sets only 1 bit.

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #6
    Jump to:
    © 2018 APG vNext Commercial Version 4.5