NO

Author Topic: compiler bug (infinite loop/allocation) when optimization!=none  (Read 1730 times)

jerome.hode

  • Guest
this code (extracted from libogg-1.1.3) sends POCC in a loop that exhausts memory when compiler's option "Optimizations" != none:

Code: [Select]
typedef unsigned long long ogg_int64_t;
typedef struct S_ogg_page {
unsigned char *header;
} ogg_page;

ogg_int64_t ogg_page_granulepos(ogg_page *og){
  unsigned char *page=og->header;
  ogg_int64_t granulepos=page[13]&(0xff);
  granulepos= (granulepos<<8)|(page[12]&0xff);
  granulepos= (granulepos<<8)|(page[11]&0xff);
  granulepos= (granulepos<<8)|(page[10]&0xff);
  granulepos= (granulepos<<8)|(page[9]&0xff);
  granulepos= (granulepos<<8)|(page[8]&0xff);
  granulepos= (granulepos<<8)|(page[7]&0xff);
  granulepos= (granulepos<<8)|(page[6]&0xff);
  return(granulepos);
}

About Pelles:
Pelles C for Windows
Version 5.00.8
RSRC0009.DLL: Version 5.00.1
SUPPORT.DLL: Version 5.00.2
POCFMT.DLL: Version 5.00.1
PORC.DLL: Version 5.00.1
POBR.DLL: Version 5.00.2
SQLITE3.DLL: Version 3.5.3
POCC.EXE: Version 5.00.13
POASM.EXE: Version 5.00.4
POLINK.EXE: Version 5.00.1
IDESPAWN.EXE: Version 5.00.1
MS Windows XP Pro, SP3 (Build 2600)

JohnF

  • Guest
Re: compiler bug (infinite loop/allocation) when optimization!=none
« Reply #1 on: August 27, 2008, 10:53:20 am »
I'm not able to reproduce that problem here.

John

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2064
    • http://www.smorgasbordet.com
Re: compiler bug (infinite loop/allocation) when optimization!=none
« Reply #2 on: September 23, 2008, 06:04:11 pm »
I can reproduce it. 64-bit integers doesn't really fit the limited x86 architecture. Yet another good reason to move on to x64.

I will look at it. You can obviously get around it by disabling optimizations (#pragma optimize etc.).
/Pelle