Pelles C forum

Pelles C => Bug reports => Topic started by: guser on April 14, 2014, 12:23:42 AM

Title: Compiler error bug in PellesC version 8.0 RC2
Post by: guser on April 14, 2014, 12:23:42 AM
Hi,

Thank you so much for your updated work on your compiler.

I'd like to report a bug in the new C compiler version 8.0 RC2.
Same code compiled fine with Pelles C version 7.0.x
I'm getting these errors:
Quote
error #3120: [asm] Symbol '_SzAlloc@8' is undefined.
error #3120: [asm] Symbol '_SzFree@8' is undefined.

My code to let you reproduce:

main.c:
Code: [Select]
#include "Types.h"
#include "7zAlloc.h"

ISzAlloc allocImp;
ISzAlloc allocTempImp;

void doit(void)
{
  allocImp.Alloc = SzAlloc;
  allocImp.Free = SzFree;
}

Extract of Types.h:
Code: [Select]
typedef struct
{
  void *(*Alloc)(void *p, size_t size);
  void (*Free)(void *p, void *address); /* address can be 0 */
} ISzAlloc;

#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
#define IAlloc_Free(p, a) (p)->Free((p), a)

7zAlloc.h:
Code: [Select]
#ifndef _7Z_ALLOC_H
#define _7Z_ALLOC_H

#include <stdlib.h>

void *SzAlloc(void *p, size_t size);
void SzFree(void *p, void *address);

void *SzAllocTemp(void *p, size_t size);
void SzFreeTemp(void *p, void *address);

#endif

Everything is correctly defined. But I'm getting undefined symbol when compiling. Note that the code completion feature correctly detects SzAlloc and SzFree.

Hope this will help you to find the solution for this bug.

Note: source files come from the 7z LZMA SDK in public domain at http://7-zip.org

Thanks!

Guser


Title: Re: Compiler error bug in PellesC version 8.0 RC2
Post by: TimoVJL on April 14, 2014, 07:47:28 AM
Optimizer problem speed/size.
Missing part for testing:
Code: [Select]
/* 7zAlloc.c -- Allocation functions
2010-10-29 : Igor Pavlov : Public domain */

#include "7zAlloc.h"

void *SzAlloc(void *p, size_t size)
{
  p = p;
  if (size == 0)
    return 0;
  return malloc(size);
}

void SzFree(void *p, void *address)
{
  p = p;
  free(address);
}

void *SzAllocTemp(void *p, size_t size)
{
  p = p;
  if (size == 0)
    return 0;
  return malloc(size);
}

void SzFreeTemp(void *p, void *address)
{
  p = p;
 free(address);
}
EDIT: example project.
Title: Re: Compiler error bug in PellesC version 8.0 RC2
Post by: aMarCruz on April 17, 2014, 05:30:35 PM
mmm...
works with __declspec(noinline) ?
Title: Re: Compiler error bug in PellesC version 8.0 RC2
Post by: Pelle on April 20, 2014, 11:52:23 AM
Please: http://forum.pellesc.de/index.php?topic=1537.0
I need a fully compilable example with compiler options used...
Title: Re: Compiler error bug in PellesC version 8.0 RC2
Post by: guser on April 21, 2014, 03:23:01 PM
Hi,

Sure I understand. I wrote a project with all options.
Then zipped project with IDE's "zip project" feature.
I attached the zip archive.

Try to compile main1.c: here is the result:

Building main1.obj.
\pellescbug\main1.c(12): error #3120: [asm] Symbol '_SzAlloc@8' is undefined.
\pellescbug\main1.c(12): error #3120: [asm] Symbol '_SzFree@8' is undefined.
*** Error code: 1 ***

Thanks!

Guser