www.delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/1998/10/31/18:57:35

X-pop3-spooler: POP3MAIL 2.1.0 b 4 980420 -bs-
Message-ID: <AgRD8nAIZ1O2Ewin@talula.demon.co.uk>
Date: Sat, 31 Oct 1998 18:26:16 +0000
To: pgcc-list AT Desk DOT nl
From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Subject: Invalid 64 bit warnings
MIME-Version: 1.0
X-Mailer: Turnpike (32) Version 3.05 <n4LQeHkuIZDKHuEabw2AtDS$Xl>
Sender: Marc Lehmann <pcg AT goof DOT com>
Status: RO
X-Status: A
Lines: 41

I'm having some problems using 64 bit (long long) integers with pgcc.
Whenever I assign from an integer to a 64 bit int, compiling with -Wall
produces a "this variable may be used unitialised" warning, even though
that is clearly not the case!

I'm using the djgpp version of pgcc, version 2.7.2p 970725.

This bug can be reproduced with a simple function like:

    int test(int x)
    {
       long long y = (long long)x;
       return (int)y;
    }

or even:

    int test(int x)
    {
       long long y;
       y = (long long)x;
       return (int)y;
    }

Compile either of those with -Wall, and they will produce an incorrect
warning message.

The only way I can find to work around it is really horrible, which is
to initialise the variable to a dummy constant first, eg:

    int test(int x)
    {
       long long y = 0;
       y = (long long)x;
       return (int)y;
    }


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Miracles are nothing if you've got the wrong intentions" - Mike Keneally

- Raw text -


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