Bug 691279 - "integer constant is too large for ‘long’ type" warning
Summary: "integer constant is too large for ‘long’ type" warning
Status: RESOLVED DUPLICATE of bug 689184
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Color (show other bugs)
Version: 8.71
Hardware: PC Linux
: P4 normal
Assignee: Michael Vrhel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-05 03:53 UTC by Sergei Steshenko
Modified: 2010-05-05 15:09 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Steshenko 2010-05-05 03:53:03 UTC
While building on a 32 bits OS I've noticed a bunch of warnings:

"
./base/gxclutil.c:410: warning: integer constant is too large for ‘long’ type
./base/gxclutil.c:411: warning: integer constant is too large for ‘long’ type
./base/gxclutil.c:412: warning: integer constant is too large for ‘long’ type
./base/gxclutil.c:413: warning: integer constant is too large for ‘long’ type
./base/gxclutil.c:422: warning: integer constant is too large for ‘long’ type
./base/gxclutil.c:423: warning: integer constant is too large for ‘long’ type
./base/gxclutil.c:424: warning: integer constant is too large for ‘long’ type
./base/gxclutil.c:425: warning: integer constant is too large for ‘long’ type
".

This is the context in 'ghostscript-8.71/base/gxclutil.c' file:


    402 #define tab_entry(x) ((x) & (~((gx_color_index) 0)))
    403
    404 const gx_color_index cmd_delta_offsets[] = {
    405         tab_entry(0),
    406         tab_entry(0),
    407         tab_entry(0x0808),
    408         tab_entry(0x102010),
    409         tab_entry(0x08080808),
    410         tab_entry(0x1020100808),
    411         tab_entry(0x080808080808),
    412         tab_entry(0x10201008080808),
    413         tab_entry(0x0808080808080808),
    414         };
    415
    416 static const gx_color_index cmd_delta_masks[] = {
    417         tab_entry(0),
    418         tab_entry(0),
    419         tab_entry(0x0f0f),
    420         tab_entry(0x1f3f1f),
    421         tab_entry(0x0f0f0f0f),
    422         tab_entry(0x1f3f1f0f0f),
    423         tab_entry(0x0f0f0f0f0f0f),
    424         tab_entry(0x1f3f1f0f0f0f0f),
    425         tab_entry(0x0f0f0f0f0f0f0f0f),
    426         };
    427
    428 #undef tab_entry
.

This is the fix (pay attention to 'ull' suffix added in some places:

#define tab_entry(x) ((x) & (~((gx_color_index) 0)))

const gx_color_index cmd_delta_offsets[] = {
        tab_entry(0),
        tab_entry(0),
        tab_entry(0x0808),
        tab_entry(0x102010),
        tab_entry(0x08080808),
        tab_entry(0x1020100808ull),
        tab_entry(0x080808080808ull),
        tab_entry(0x10201008080808ull),
        tab_entry(0x0808080808080808ull),
        };

static const gx_color_index cmd_delta_masks[] = {
        tab_entry(0),
        tab_entry(0),
        tab_entry(0x0f0f),
        tab_entry(0x1f3f1f),
        tab_entry(0x0f0f0f0f),
        tab_entry(0x1f3f1f0f0full),
        tab_entry(0x0f0f0f0f0f0full),
        tab_entry(0x1f3f1f0f0f0f0full),
        tab_entry(0x0f0f0f0f0f0f0f0full),
        };

#undef tab_entry
Comment 1 Hin-Tak Leung 2010-05-05 15:09:42 UTC
Please check existing bug reports before filing new ones.

*** This bug has been marked as a duplicate of bug 689184 ***