NO

Author Topic: Compiler error bug in PellesC version 8.0 RC2  (Read 2883 times)

guser

  • Guest
Compiler error bug in PellesC version 8.0 RC2
« 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



Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Compiler error bug in PellesC version 8.0 RC2
« Reply #1 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.
« Last Edit: May 04, 2014, 11:04:13 AM by TimoVJL »
May the source be with you

aMarCruz

  • Guest
Re: Compiler error bug in PellesC version 8.0 RC2
« Reply #2 on: April 17, 2014, 05:30:35 PM »
mmm...
works with __declspec(noinline) ?

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Compiler error bug in PellesC version 8.0 RC2
« Reply #3 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...
/Pelle

guser

  • Guest
Re: Compiler error bug in PellesC version 8.0 RC2
« Reply #4 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