Compiler problem ?!

This is a discussion on Compiler problem ?! within the C Programming forums, part of the General Programming Boards category; Hello, today while working on ColdFire microchip with Freescale Codewarrior 6.4 I encountered a problem. Lets say one function is ...

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    4

    Compiler problem ?!

    Hello,

    today while working on ColdFire microchip with Freescale Codewarrior 6.4 I encountered a problem.
    Lets say one function is composed of other functions, and when I compile the code it seems like
    that this other functions aren't included in the output file.

    This functions are used for separating bytes from an short or a long in and to merge 2 bytes into a short and 4 bytes into a long int. The sample code could be seen below:

    Code:
    UINT16 convert_two_bytes_to_UINT16(UINT8 *bytes)
    {    UINT16 result = bytes[0];
        result <<= 8;
        result |= bytes[1];
        return result;
    }
    When I use this function in the main function, in the neverending loop the function works and the return value corresponds to the value of 2 bytes.

    I don't know what do to, so if somebody had simmilar problems I cindly ask them for some help.
    Thanks and best regards,
    BoSCHoW.

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,160
    You're getting the right results?

    What's the problem?

  3. #3
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,424
    it seems like
    that this other functions aren't included in the output file.
    And why is it seems so?
    may be it is just inlined...
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,344
    I agree with vart, maybe the optimiser has done some pruning and merging of the output file.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,160
    Quote Originally Posted by Salem View Post
    I agree with vart, maybe the optimiser has done some pruning and merging of the output file.
    The function should still exist in the object file (since some other module might refer to it) but it may not exist at all in the executable.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dev-C++ compiler problem
    By GrasshopperEsq in forum C++ Programming
    Replies: 19
    Last Post: 05-08-2008, 02:35 AM
  2. Compiler Problem
    By sitestem in forum C++ Programming
    Replies: 2
    Last Post: 04-11-2004, 03:48 PM
  3. Replies: 5
    Last Post: 12-03-2003, 04:47 PM
  4. Problem with compiler
    By knight543 in forum C++ Programming
    Replies: 4
    Last Post: 02-09-2002, 08:16 PM
  5. Please help me with this compiler problem
    By incognito in forum C++ Programming
    Replies: 1
    Last Post: 01-05-2002, 04:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21