delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/07/31/09:05:26

From: pavenis AT lanet DOT lv
Message-ID: <B0000096582@stargate.astr.lu.lv>
To: djgpp-workers AT delorie DOT com
Date: Sat, 31 Jul 1999 15:31:31 +0300
MIME-Version: 1.0
Subject: sscanf() format %p seems to be broken
X-mailer: Pegasus Mail for Win32 (v3.11)
Reply-To: djgpp-workers AT delorie DOT com

Below is slightly editted test (I only removed #include "confdefs.h") 
from gcc-2.95 configure which tries to detect whether printf 
supports format %p. With 28 July CVS version of libc.a this test 
fails.

Andris

-----------------------------
#include <stdio.h>

main()
{
  char buf[64];
  char *p = buf, *q = NULL;
  sprintf(buf, "%p", p);
  sscanf(buf, "%p", &q);
  exit (p != q);
}

-----------------------------
main () at xxx.c:6
6         char *p = buf, *q = NULL;
(gdb) n
7         sprintf(buf, "%p", p);
(gdb) n
8         sscanf(buf, "%p", &q);
(gdb) n
9         exit (p != q);
(gdb) p p
$1 = 0x908c4 "908c4"
(gdb) p q
$2 = 0x38c ""
(gdb) q


- Raw text -


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