Bug 44251 - integer constant is too large for ‘long’ type in alpha.c
Summary: integer constant is too large for ‘long’ type in alpha.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-23 05:26 UTC by Jay
Modified: 2015-02-12 23:06 UTC (History)
2 users (show)

See Also:
Host: alpha-dec-vms
Target: alpha-dec-vms
Build: i686-apple-darwin9
Known to work: 4.8.0
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jay 2010-05-23 05:26:53 UTC
Trivial:


src/gcc-4.5.0/gcc/config/alpha/alpha.c: In function ‘alpha_trampoline_init’:
/src/gcc-4.5.0/gcc/config/alpha/alpha.c:5580: warning: integer constant is too large for ‘long’ type
/src/gcc-4.5.0/gcc/config/alpha/alpha.c:5591: warning: integer constant is too large for ‘long’ type
/src/gcc-4.5.0/gcc/config/alpha/alpha.c:5592: warning: integer constant is too large for ‘long’ type


jbook2:gcc jay$ diff -u /src/orig/gcc-4.5.0/gcc/config/alpha/alpha.c /src/gcc-4.5.0/gcc/config/alpha/alpha.c
--- /src/orig/gcc-4.5.0/gcc/config/alpha/alpha.c	2010-04-02 12:54:46.000000000 -0700
+++ /src/gcc-4.5.0/gcc/config/alpha/alpha.c	2010-05-22 22:16:49.000000000 -0700
@@ -5577,7 +5577,7 @@
 	 the function's procedure descriptor with certain fields zeroed IAW
 	 the VMS calling standard. This is stored in the first quadword.  */
       word1 = force_reg (DImode, gen_const_mem (DImode, fnaddr));
-      word1 = expand_and (DImode, word1, GEN_INT (0xffff0fff0000fff0), NULL);
+      word1 = expand_and (DImode, word1, GEN_INT (0xffff0fff0000fff0LL), NULL);
     }
   else
     {
@@ -5588,8 +5588,8 @@
 	    nop
 	 We don't bother setting the HINT field of the jump; the nop
 	 is merely there for padding.  */
-      word1 = GEN_INT (0xa77b0010a43b0018);
-      word2 = GEN_INT (0x47ff041f6bfb0000);
+      word1 = GEN_INT (0xa77b0010a43b0018LL);
+      word2 = GEN_INT (0x47ff041f6bfb0000LL);
     }
 
   /* Store the first two words, as computed above.  */
@@ -6642,7 +6642,6 @@
       }
 }


Though I do wonder if there is a more portable form,
like one for systems without a 64bit type or where "LL" isn't the extension.
(or for systems without long long but a 64bit long)


Like:
#if !(defined(_MSC_VER) || defined(__DEC))
#define __int64 long long
#define MAKE_INT64(x) x##LL
#define MAKE_UINT64(x) x##ULL
#else
#define MAKE_INT64(x) x##i64
#define MAKE_UINT64(x) x##ui64
#endif


or:

#if !(defined(_MSC_VER) || defined(__DEC))
#define __int64 long long
#endif
#define MAKE_INT64(hi, lo) ((((unsigned __int64)hi) << 32) | lo)


and yes I realize "long" might be 64bits, so there might be further refinements.

#if !(defined(_MSC_VER) || defined(__DEC))
#ifdef _LP64
#define __int64 long
#define MAKE_INT64(x) x##L
#define MAKE_UINT64(x) x##UL
#else
#define __int64 long long
#define MAKE_INT64(x) x##LL
#define MAKE_UINT64(x) x##ULL
#endif
#else
#define MAKE_INT64(x) x##i64
#define MAKE_UINT64(x) x##ui64
#endif


or somesuch, but I tested assigning a long long to a long on Darwin/amd64
and no warning (even though in some "portable" sense, it should warn).
(I'll open a bug about that.)


 - Jay
Comment 1 Richard Henderson 2015-02-12 23:06:44 UTC
Fixed in r188535.