[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#261513: marked as done (gcc-3.3: strtof only in c99 but not undefined reference otherwise)



Your message dated Sat, 7 Aug 2004 09:01:02 +0200
with message-id <16660.32302.341703.176672@gargle.gargle.HOWL>
and subject line Bug#261513: My fault, implicit declaration with overflow
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 26 Jul 2004 13:16:33 +0000
>From dominique.massonie@lia.univ-avignon.fr Mon Jul 26 06:16:33 2004
Return-path: <dominique.massonie@lia.univ-avignon.fr>
Received: from dns.iup.univ-avignon.fr (D350.iup.univ-avignon.fr) [194.57.216.30] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1Bp5LE-0004mz-00; Mon, 26 Jul 2004 06:16:32 -0700
Received: from prt-domi.iup.univ-avignon.fr (massonie@prt-domi.iup.univ-avignon.fr [194.57.216.118])
	by D350.iup.univ-avignon.fr (8.9.3 (PHNE_28760)/8.9.3) with ESMTP id PAA06071;
	Mon, 26 Jul 2004 15:16:00 +0200 (METDST)
Message-Id: <200407261316.PAA06071@D350.iup.univ-avignon.fr>
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: MASSONIE Dominique <dominique.massonie@lia.univ-avignon.fr>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: gcc-3.3: strtof only in c99 but not undefined reference otherwise
X-Mailer: reportbug 2.63
Date: Mon, 26 Jul 2004 17:11:41 +0200
Delivered-To: submit@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
	autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 

Package: gcc-3.3
Version: 1:3.3.4-5
Severity: normal



-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.24+d1
Locale: LANG=C, LC_CTYPE=C

Versions of packages gcc-3.3 depends on:
ii  binutils                   2.14.90.0.7-8 The GNU assembler, linker and bina
ii  cpp-3.3                    1:3.3.4-5     The GNU C preprocessor
ii  gcc-3.3-base               1:3.3.4-5     The GNU Compiler Collection (base 
ii  libc6                      2.3.2.ds1-13  GNU C Library: Shared libraries an
ii  libgcc1                    1:3.4.1-3     GCC support library

-- no debconf information

/*
  The following sample code uses function "strtof".
  Compiled without -std=c99 it produces some bad results instead of a
  compilation error (IMHO: undefined reference to `strtof')
*/

#include <stdlib.h> /* needed for strtod and strtof */
#include <stdio.h>  /* needed for fprintf */

// some related information:
//  - man strtod, strtof, strtold:
//    CONFORMING TO
//       ANSI C describes strtod, C99 describes the other two functions.
//
//  - in /usr/include/stdlib.h
//
// #ifdef  __USE_ISOC99
// __BEGIN_NAMESPACE_C99
// ...
// extern float strtof (__const char *__restrict __nptr,
//                      char **__restrict __endptr) __THROW;
// ...
// __END_NAMESPACE_C99
// #endif

int main (void)
{
    const char buf[] = "123.45";

    fprintf (stdout, "result %f == %f and 6 == %d\n",
	     (float)strtod (buf, NULL),
	     strtof (buf, NULL),
	     6);
    exit (0);
}

// ok with:  gcc -Wall -std=c99 test_strtof.c
//
// without -std=c99 should get (IMHO):
//: undefined reference to `strtof'
// but instead get broken output like:
// result 123.449997 == 0.000000 and 6 == 1073970383

---------------------------------------
Received: (at 261513-done) by bugs.debian.org; 7 Aug 2004 07:01:10 +0000
>From doko@cs.tu-berlin.de Sat Aug 07 00:01:10 2004
Return-path: <doko@cs.tu-berlin.de>
Received: from mail.cs.tu-berlin.de [130.149.17.13] (root)
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1BtLCX-0001pc-00; Sat, 07 Aug 2004 00:01:10 -0700
Received: from mailhost.cs.tu-berlin.de (postfix@mail.cs.tu-berlin.de [130.149.17.13])
	by mail.cs.tu-berlin.de (8.9.3p2/8.9.3) with ESMTP id JAA17316;
	Sat, 7 Aug 2004 09:01:08 +0200 (MEST)
Received: from localhost (localhost [127.0.0.1])
	by mailhost.cs.tu-berlin.de (Postfix) with ESMTP id 04377FE18;
	Sat,  7 Aug 2004 09:01:08 +0200 (MEST)
Received: from mailhost.cs.tu-berlin.de ([127.0.0.1])
 by localhost (bueno [127.0.0.1]) (amavisd-new, port 10224) with ESMTP
 id 23232-48; Sat,  7 Aug 2004 09:01:07 +0200 (MEST)
Received: from bolero.cs.tu-berlin.de (bolero.cs.tu-berlin.de [130.149.19.1])
	by mailhost.cs.tu-berlin.de (Postfix) with ESMTP;
	Sat,  7 Aug 2004 09:01:02 +0200 (MEST)
Received: (from doko@localhost)
	by bolero.cs.tu-berlin.de (8.12.10+Sun/8.12.8/Submit) id i7771285008924;
	Sat, 7 Aug 2004 09:01:02 +0200 (MEST)
From: Matthias Klose <doko@cs.tu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <16660.32302.341703.176672@gargle.gargle.HOWL>
Date: Sat, 7 Aug 2004 09:01:02 +0200
To: MASSONIE Dominique <dominique.massonie@lia.univ-avignon.fr>,
        261513-done@bugs.debian.org
Subject: Re: Bug#261513: My fault, implicit declaration with overflow
In-Reply-To: <41054C85.2020709@lia.univ-avignon.fr>
References: <41054C85.2020709@lia.univ-avignon.fr>
X-Mailer: VM 7.03 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid
X-Virus-Scanned: by amavisd-new at cs.tu-berlin.de
Delivered-To: 261513-done@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
	autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 

MASSONIE Dominique writes:
> Hi,
> 
> I investigated a bit more my problem and found that what I expected about
> fprintf and the '6' was normal behavior (ie. %f waits for a double and
> strtof implicit declaration returns an int thus the 6 is lost in the call stack,
> as the warning shows).
> 
> All is 'fixed' by simply changing the sample code with:
> int main (void)
> {
>      const char buf[] = "123.45";
>      const float f1 = (float)strtod (buf, NULL);
>      const float f2 = (float)strtof (buf, NULL);
> 
>      fprintf (stdout, "result %f == %f and 6 == %d\n",
> 	     f1,
> 	     f2,
> 	     6);
>      exit (0);
> }
> 
> The missing or implicit declaration remains but that's ok.
> Thanks for closing this bigreport, sorry for the work.

done.



Reply to: