×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Apr 2004
    Posts
    71

    GCC compilling bad!!!!!! (KERN-EXEC 3)

    I recive KERN-EXEC 3 error during executing my app. It's happen in stupid place;
    I know its a gcc error because I can still compile it to work well,but is a lot of work...

    My compiled code is about 158KB size. Compiled using SDK S60 1_2 ARM on MSV2003, (but trouble is with gcc....)

    To describe it I will use 3 different ways to compile code:
    I.
    During compiling with Optimisation flag i recive Internal Compiler Error. If i remove this flags it is compiling well , but
    <b>ITS NOT WORKING ON DEVICE</b> (invalid line of code is listed on bottom)

    II.
    How to fix it....
    If i REBUILD application USING -O2 flag and let the compiler compile part of code until it crush, and then REMOVE optimisation flag and BUILD again (note that some code is compiled with o2 and will not be recompiled at this time)
    everything is working well. My app is working very well on a device (SX1).

    III.
    I donloaded fixed gcc from Symbian GCC Improvement Project
    ( http://www.inf.u-szeged.hu/symbian-gcc/dload.php ) and compile my code even with -O2 flag there is no error at this stage. (It used to be : Internal Compiler error... and some strange marks:) ). Its CRUSHES on device.

    I know the exactly pleace because after month of looking for error I builded log engine and it shows bad lines:)

    I use:
    TUint8 *pBuffer /*BYTE TABLE with some lenght*/
    TUint8 *pPtr; /*pointer used*/
    Error is in following code:

    1. const TUint8 *pPtr = pBuffer;
    2. pPtr += 5;
    3. TInt nVertices = *( TUint16* )pPtr;
    4. pPtr += sizeof( TInt16 /*short*/ );
    5. TInt16 x = *( TInt16* )pPtr;

    /*NOTE: pBuffer is pointer set at begin of BYTE buffer with 350 in size*/

    During Compilation using FIRST way the bad line is: 5. This line is the reason of KERN-EXEC 3

    During Compilation using THIRD way the bad line is: 3. This line is now the reason of KERN-EXEC 3



    NOTE that WAY 2 is valid....
    During SECOND way the valid part of code is compiled with O2 flag. That why its working...

    Its strange , but this part of code was created some time ago and was working well up to now.... I think the problem might be appearing when code is big...

    Please comment it....
    Maybe you know any solution?????

  2. #2
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122

    Re: GCC compilling bad!!!!!! (KERN-EXEC 3)

    It's not GCC, it's the processor architecture combined with programming errors.

    Seems like you're trying to read a TInt16 from and odd address. On ARM, you need to have your 16-bit data aligned to a 16-bit boundary, i.e. an even address. As a workaround, read your TInt16s as two T(U)Int8s.

    Lauri

  3. #3
    Regular Contributor
    Join Date
    Apr 2004
    Posts
    71

    Re: GCC compilling bad!!!!!! (KERN-EXEC 3)

    Hi Lauri,
    and thanks for answer.

    I don't know if I understood you correctly...

    If I have TUint8 dynamic array with 6 in size. Pointer is always even.

    So I can only read T(U)int16 from:
    (Pointer*) + 0 ; * + 2 ; * + 4
    but definitely NOT from:
    (Pointer*) +3

    And I can't read T(U)int32 from (Pointer*) +1

    Am I right????????????????


    If yes than due to 32 bit architecture could I also read
    (Pointer*) +1 as TUint16???? Or 16 bit word is always sticked in 16 bit


    Wojtek Freliszka
    Last edited by fwojtek; 2005-11-16 at 14:47.

  4. #4
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122

    Re: GCC compilling bad!!!!!! (KERN-EXEC 3)

    I'll try to clarify. You can only access T(U)Int16 in addresses divisible by 2 i.e. aligned to a 2-byte boundary. You can only access T(U)Int32 in addresses divisible by 4 i.e. aligned to a 4-byte boundary. On ARM, you will get an exception on unaligned memory access (KERN-EXEC 3 on Symbian). On Intel x86, unaligned memory access works, although it is slower (memory is accessed twice, not just once).

    So basically, I think you got most of the point. You can't read (Pointer*)+1 as TUint16 as it is not an address aligned to a 2-byte boundary.

    Lauri

  5. #5
    Regular Contributor
    Join Date
    Apr 2004
    Posts
    71

    Re: GCC compilling bad!!!!!! (KERN-EXEC 3)

    Thanks Lauri

    I got it. Thanks for clarificaion.
    Its time to read some ARM docs...:)

    Wojtek

Similar Threads

  1. Replies: 2
    Last Post: 2007-07-19, 01:29
  2. why kern exec 3 on CopyFile?
    By flicker82 in forum Symbian
    Replies: 2
    Last Post: 2005-05-16, 02:25
  3. please help! setting page issue (checkbox) kern exec 3
    By flicker82 in forum Symbian User Interface
    Replies: 4
    Last Post: 2005-02-10, 12:57
  4. KERN EXEC 3 system Error
    By pankajmahto in forum Symbian
    Replies: 7
    Last Post: 2004-05-24, 04:03
  5. DirectGraphics/fillPolygon and KERN - EXEC 3 on 7650
    By andrew_nevick in forum Mobile Java General
    Replies: 0
    Last Post: 2003-03-03, 09:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×