This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Arbitrary precision representation for numeric constants?


Richard Henderson wrote:
> 
> We support integers up to twice the host word width.  We can
> force the "host word" to "long long" for cross compiles.
> 
> This works out ok for every target we've seen so far.

My problem is the following:  When I multiply two `unsigned long long'
constants using fold() (called from build_binary_op()), the result does
not get the "overflow" bit set.

`fold()'ing this:

   <mult_expr 0x827fb94
      type <integer_type 0x8262e24 Longestcard allocated from permanent_obstack
          unsigned permanent DI
          size <integer_cst 0x825e570 constant permanent 64>
          align 32 symtab 0 alias set -1 precision 64
          min <integer_cst 0x8262e84 constant permanent 0>
          max <integer_cst 0x8262e9c constant permanent -1>>
      allocated from permanent_obstack
      permanent
      arg 0 <integer_cst 0x827fb50 type <integer_type 0x8262e24 Longestcard> constant unsigned permanent 0x8000000000000000>
      arg 1 <integer_cst 0x827fb7c type <integer_type 0x8262e24 Longestcard> constant unsigned permanent 2>>

results in this:

   <integer_cst 0x827fbac type <integer_type 0x8262e24 Longestcard> constant permanent 0>

In other situations, such an overflow is recognized in the
`overflow' bit of the result.  But with `unsigned long long' the
frontend gets no chance to notice the overflow and to output an
error message.

    Peter

-- 
http://home.pages.de/~Peter.Gerwinski/ - G-N-U GmbH: http://www.g-n-u.de
Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-19990118
GnuPG key fingerprint: 9E7C 0FC4 8A62 5536 1730 A932 9834 65DB 2143 9422
keys: ftp://ftp.gerwinski.de/pub/keys/ - AntiSpam: http://spam.abuse.net

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]