[BUG REPORT] Fehler beim Optimizer

  • 1
  • 2
  • 3
  • Page 1 of 3
Thomas.AC
Benutzer
Avatar
Gender: n/a
Age: 43
Posts: 308
Registered: 07 / 2013
Subject:

[BUG REPORT] Fehler beim Optimizer

 · 
Posted: 20.02.2015 - 15:27  ·  #1
Hallo,

ich habe einen Bug gefunden, der nur mit Optimiser auftritt.
Mein Beispiel hat keinen praktischen Sinn mehr, nachdem ich den Code auf wenige Zeilen reduzieren konnte (war mühselig). Bitte nicht verwirren lasse, "for i:=0 to 0 do" und ein case Block, der eigentlich nichts macht, sind natürlich verwunderlich.

Fehlerbeschreibung:
Es existiert eine globale String-Variable "textbuffer", die nach Aufruf von "stimu" den Wert "datei123.txt" haben müsste. Hat sie aber nicht. Siehe Bild

AVRco: 5.04.96
Optimise: 3.2.11.0


Gruß
Thomas.AC

Code

program audioplayer;     //   f_cpu = 32,768 MHz

{ $W+}

Device = xmega128A4U, VCC = 3.3;

Define_Fuses
    Override_Fuses;
    NoteBook   = A;
    COMport    = USB;
    FuseBits5  = [BODLEVEL0, BODLEVEL1, BODLEVEL2, BODACT0]; // BOD=3V if X-AU
    ProgFuses = true;

Import SysTick;

Define
    OSCtype        = extXTAL=4096000, PLLmul=8, prescA=1, prescB=1, prescC=1,
                     overdrive, faildet;
    SysTick        = 10;
    StackSize      = 128, iData;
    FrameSize      = 256, iData;


Implementation

{$IDATA}

var textbuffer : string[12];

function stimu : byte;
var
  filename : string[12];
  i : byte;
  x : byte;
begin
  for i:=0 to 0 do
    if true then
      filename := 'datei123.txt';
      textbuffer := filename;
      if filename <> 'datei123.txt' then
        textbuffer := filename;
        continue;
      endif;
      x := 0;
      case x of
        1 : Return (0);
          |
        2 : Return (0);
          |
      endcase;
      textbuffer := filename;
    endif;
  endfor;
  Return (0);
end;


begin
  EnableInts($87); // enable all IRQ
  loop
    stimu();
    debug_break; // Fehler nach Aufruf, textbuffer hat einen falschen Inhalt
  endloop;
end audioplayer.

Attachments
Fehlerbild Simulator
Filename: datei123.png
Filesize: 37.55 KB
Title: Fehlerbild Simulator
Download counter: 116
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: [BUG REPORT] Fehler beim Optimizer

 · 
Posted: 20.02.2015 - 19:30  ·  #2
Hallo Thomas,

bitte das ganze nochmal in englisch an user Merlin schicken.
Danke.

rolf
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: [BUG REPORT] Fehler beim Optimizer

 · 
Posted: 22.02.2015 - 14:42  ·  #3
Hello Thomas.

I have a thought as to what the issue might be, but could you send me the files audioplayer.asm and audioplayer.dsm obtained after optimisation, either through this post or via pm, and I will check it out.
Thomas.AC
Benutzer
Avatar
Gender: n/a
Age: 43
Posts: 308
Registered: 07 / 2013
Subject:

Re: [BUG REPORT] Fehler beim Optimizer

 · 
Posted: 23.02.2015 - 08:28  ·  #4
@Merlin. See pm for the files and good luck. :-)
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: [BUG REPORT] Fehler beim Optimizer

 · 
Posted: 23.02.2015 - 10:00  ·  #5
Thank you Thomas, but there is nothing in my inbox yet.
Thomas.AC
Benutzer
Avatar
Gender: n/a
Age: 43
Posts: 308
Registered: 07 / 2013
Subject:

Re: [BUG REPORT] Fehler beim Optimizer

 · 
Posted: 23.02.2015 - 10:18  ·  #6
You are right, I am confused.
See attachement for the files.
Attachments
Filename: audioplayer asm dsm.zip
Filesize: 21.42 KB
Title: audioplayer asm dsm
Information: audioplayer asm dsm
Download counter: 24
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: [BUG REPORT] Fehler beim Optimizer

 · 
Posted: 23.02.2015 - 10:23  ·  #7
Thank you Thomas.
Merlin
Administrator
Avatar
Gender:
Age: 24
Posts: 1409
Registered: 03 / 2005
Subject:

Re: [BUG REPORT] Fehler beim Optimizer

 · 
Posted: 23.02.2015 - 15:26  ·  #8
Hi Thomas.

As far as I can see everything seems OK. Is this a problem with real hardware, or purely in the simulator? It could be a false value in the simulator but I am not sure why that might be. The optimiser reduces the stack size by 3 bytes, and the string value is offset by 3 bytes, so it would seem to be related to this, but I adjust all the .FRAME values correctly.

Addendum: I have traced through the simulator and I am pretty convinced that it is an artifact of the simulator, but I am not sure why. For example, when you trace through the PAS you get different values for the local variable to when you trace through ASM. I guess Rolf and I will have to try to find out what is going on here.

@Rolf

Is it possible that I have not changed a value that the simulator depends on to locate local variables? I will contact you via pm.
  • 1
  • 2
  • 3
  • Page 1 of 3
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 17 · Cache Hits: 15   139   154 · Page-Gen-Time: 0.032882s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI