#1775 [PIC14]Unexpected code;union bitfield with byte

open
nobody
PIC14
5
2013-07-16
2011-04-03
Gál Zsolt
No

SDCC : pic16/pic14 3.0.2 #6382 (Mar 31 2011) (Linux)

I attached a little example, where I faced a strange behaviour. My original project divided more parts, so my variable got initial value in an other part and not in the main function. That cause problem in my program which is visible in the example.
I made a union to make easier way to manipulate bits which are flags. If I want to clear all flags, I simple clear the common byte by put zero into it. The compiled code is very different If I give initial value to the common byte or not giving any. If I give initial value the result is equal with that I expected. If I don't give any initial value before the "if( )" statment, I got only a "bit clear" mnemonic in the compiled code instead of a "clear file". I don't understand, why I got this difference.

Discussion

  • Gál Zsolt

    Gál Zsolt - 2011-04-03

    This is a test file with comment to show the problematic part.

     
  • Gál Zsolt

    Gál Zsolt - 2011-04-04

    I found an option which could eliminate this problem.
    --nogcse

     
  • Philipp Klaus Krause

    • Category: --> PIC14
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks