www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/07/10:15:14

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Message-ID: <3C629769.AEAFB611@cyberoptics.com>
Date: Thu, 07 Feb 2002 09:04:09 -0600
From: Eric Rudd <rudd AT cyberoptics DOT com>
Organization: CyberOptics
X-Mailer: Mozilla 4.72 [en] (Win95; U)
X-Accept-Language: en,pdf
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Alignment problem
Lines: 39
NNTP-Posting-Host: 65.214.97.102
X-Trace: 1013094267 reader1.ash.ops.us.uu.net 29344 65.214.97.102
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

When I execute the small program

#include <stdio.h>
#include <stdlib.h>

int main(void) {
   void *ptr;

   ptr = malloc(1024);
   if (((int) ptr) & 7) {
      printf(" ptr %p not 8-byte aligned.\n", ptr);
   } else {
      printf(" ptr %p     8-byte aligned.\n", ptr);
   }
   free(ptr);
   return 0;
}

I get output like

 ptr 8f4e4 not 8-byte aligned.

about half the time.  I am currently running gcc 2.95.3, binutils
2.11.2, CWSDPMI r5 under PC-DOS 6.3.  The problem also exists in a DOS
box under Win95 (where CWSDPMI is not being used).

I am calling gcc with the following options:

   -O2
   -march=pentium
   -Wall
   -fomit-frame-pointer

I thought that this alignment problem had been solved in gcc 2.95 and
binutils 2.9.1.  What should I do to diagnose this problem further?

-Eric Rudd
rudd AT cyberoptics DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019