#302 compiler warnings with gcc-4.1 on 64bit architectures

system-dependent
closed-fixed
Stefan Ulrich
5
2014-03-20
2006-06-07
Frank Küster
No

gcc 4.1 is more strict than previous versions, and
produces some compiler warnings with stable xdvi. As
described in

http://lists.debian.org/debian-devel-announce/2006/06/msg00004.html

the problem might lead to wrong code, especially on
64bit machines:

> These warnings may point to code which is not 64bit
> clean. They are most likely not seen on 32bit
> architectures. See the amd64, alpha and ia64 build
> logs for these architecture specific warnings.

Actually I don't expect that this is a big thing,
because xdvi is already used on such platforms, and the
actual compiled code shouldn't be changed by the
warning. But it might still make sense to look into
this. Here's a build log with gcc-4.1:

http://people.debian.org/~tbm/logs/pointer/long/tetex-bin_3.0-16_20060528-0423.bz2

(search for "cast from pointer to").

Regards, Frank

Discussion

  • Stefan Ulrich
    Stefan Ulrich
    2006-06-10

    Logged In: YES
    user_id=177175

    Thanks very much for the diagnostics, I'll have a look at it.

     
  • Stefan Ulrich
    Stefan Ulrich
    2006-06-10

    • assigned_to: nobody --> stefanulrich
     
  • Stefan Ulrich
    Stefan Ulrich
    2007-08-06

    • summary: compiler warnings with gcc-4.1 --> compiler warnings with gcc-4.1 on 64bit architectures
     
  • Logged In: YES
    user_id=1982499
    Originator: NO

    Building 22.84.13 with

    gcc -DHAVE_CONFIG_H -I. -I. -I.. -I./.. -W -Wall -Wunused -DPS_GS -I./gui -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic

    gives the following warnings:

    dvi-init.c: In function 'define_font':
    dvi-init.c:622: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
    dvi-init.c: In function 'process_preamble':
    dvi-init.c:731: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
    events.c: In function 'home':
    events.c:722: warning: cast to pointer from integer of different size
    events.c:729: warning: cast to pointer from integer of different size
    events.c: In function 'home_bottom':
    events.c:770: warning: cast to pointer from integer of different size
    events.c:773: warning: cast to pointer from integer of different size
    events.c: In function 'get_geom':
    events.c:872: warning: cast to pointer from integer of different size
    events.c:885: warning: cast to pointer from integer of different size
    dvisel.c: In function 'FontWrite':
    dvisel.c:173: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
    dvisel.c:174: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
    dvisel.c: In function 'select_pages':
    dvisel.c:622: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
    dvisel.c:625: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
    events.c: In function 'Act_center':
    events.c:1755: warning: cast to pointer from integer of different size
    events.c:1757: warning: cast to pointer from integer of different size
    events.c: In function 'Act_left':
    events.c:1880: warning: cast to pointer from integer of different size
    events.c: In function 'Act_right':
    events.c:1917: warning: cast to pointer from integer of different size
    events.c: In function 'Act_up':
    events.c:1952: warning: cast to pointer from integer of different size
    events.c: In function 'Act_down':
    events.c:1987: warning: cast to pointer from integer of different size
    events.c: In function 'Act_down_or_next':
    events.c:2029: warning: cast to pointer from integer of different size
    events.c: In function 'Act_up_or_previous':
    events.c:2081: warning: cast to pointer from integer of different size
    events.c: In function 'Act_fullscreen':
    events.c:2580: warning: cast to pointer from integer of different size
    events.c:2602: warning: cast to pointer from integer of different size
    events.c: In function 'drag_motion':
    events.c:3434: warning: cast to pointer from integer of different size
    events.c:3448: warning: cast to pointer from integer of different size
    events.c: In function 'Act_wheel':
    events.c:3497: warning: cast to pointer from integer of different size

    message-window.c: In function 'ok_action':
    message-window.c:248: warning: cast from pointer to integer of different size
    message-window.c: In function 'cancel_action':
    message-window.c:331: warning: cast from pointer to integer of different size
    message-window.c: In function 'create_dialogs':
    message-window.c:620: warning: cast to pointer from integer of different size
    message-window.c:662: warning: cast to pointer from integer of different size

    pk.c: In function 'read_PK_index':
    pk.c:377: warning: ignoring return value of 'fread', declared with attribute warn_unused_result

    print-internal.c: In function 'fork_dvips':
    print-internal.c:181: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result
    print-internal.c:185: warning: ignoring return value of 'getcwd', declared with attribute warn_unused_result

    sfDraw.c: In function 'SFscrollTimer':
    sfDraw.c:434: warning: cast from pointer to integer of different size
    sfDraw.c:465: warning: cast to pointer from integer of different size
    sfDraw.c: In function 'SFnewInvertEntry':
    sfDraw.c:504: warning: cast to pointer from integer of different size
    sfSelFile.c: In function 'SFexposeList':
    sfSelFile.c:166: warning: cast from pointer to integer of different size
    sfSelFile.c: In function 'SFcreateWidgets':
    sfSelFile.c:560: warning: cast to pointer from integer of different size
    sfSelFile.c:562: warning: cast to pointer from integer of different size
    sfSelFile.c:576: warning: cast to pointer from integer of different size
    sfSelFile.c:578: warning: cast to pointer from integer of different size
    sfSelFile.c:718: warning: cast to pointer from integer of different size
    sfSelFile.c:720: warning: cast to pointer from integer of different size
    sfSelFile.c:722: warning: cast to pointer from integer of different size
    sfSelFile.c:724: warning: cast to pointer from integer of different size
    sfSelFile.c:726: warning: cast to pointer from integer of different size
    sfSelFile.c:728: warning: cast to pointer from integer of different size

    util.c: In function 'my_realpath':
    util.c:581: warning: ignoring return value of 'fchdir', declared with attribute warn_unused_result
    util.c:591: warning: ignoring return value of 'fchdir', declared with attribute warn_unused_result
    util.c: In function 'fork_process':
    util.c:1050: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result
    util.c:1053: warning: ignoring return value of 'getcwd', declared with attribute warn_unused_result
    util.c: In function 'find_file':
    util.c:1466: warning: ignoring return value of 'fchdir', declared with attribute warn_unused_result

    vf.c: In function 'read_VF_index':
    vf.c:159: warning: ignoring return value of 'fread', declared with attribute warn_unused_result

    x_util.c: In function 'scroll_page_if_needed':
    x_util.c:129: warning: cast to pointer from integer of different size
    x_util.c:139: warning: cast to pointer from integer of different size

    xlwradio.c:212: warning: excess elements in struct initializer
    xlwradio.c:212: warning: (near initialization for 'radioClassRec.simple_class')
    xlwradio.c: In function 'RadioClassInit':
    xlwradio.c:257: warning: implicit declaration of function 'XawInitializeWidgetSet'
    xlwradio.c:212: warning: excess elements in struct initializer
    xlwradio.c:212: warning: (near initialization for 'radioClassRec.simple_class')
    xlwradio.c: In function 'RadioClassInit':
    xlwradio.c:257: warning: implicit declaration of function 'XawInitializeWidgetSet'

    dvisel.c: In function 'FontWrite':
    dvisel.c:174: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
    dvisel.c:175: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
    dvisel.c: In function 'select_pages':
    dvisel.c:623: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
    dvisel.c:626: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
    events.c: In function 'home':
    events.c:722: warning: cast to pointer from integer of different size
    events.c:729: warning: cast to pointer from integer of different size
    events.c: In function 'home_bottom':
    events.c:770: warning: cast to pointer from integer of different size
    events.c:773: warning: cast to pointer from integer of different size
    events.c: In function 'get_geom':
    events.c:872: warning: cast to pointer from integer of different size
    events.c:885: warning: cast to pointer from integer of different size

    events.c: In function 'Act_center':
    events.c:1755: warning: cast to pointer from integer of different size
    events.c:1757: warning: cast to pointer from integer of different size
    events.c: In function 'Act_left':
    events.c:1880: warning: cast to pointer from integer of different size
    events.c: In function 'Act_right':
    events.c:1917: warning: cast to pointer from integer of different size
    events.c: In function 'Act_up':
    events.c:1952: warning: cast to pointer from integer of different size
    events.c: In function 'Act_down':
    events.c:1987: warning: cast to pointer from integer of different size
    events.c: In function 'Act_down_or_next':
    events.c:2029: warning: cast to pointer from integer of different size
    events.c: In function 'Act_up_or_previous':
    events.c:2081: warning: cast to pointer from integer of different size
    events.c: In function 'Act_fullscreen':
    events.c:2580: warning: cast to pointer from integer of different size
    events.c:2602: warning: cast to pointer from integer of different size
    dvi-init.c: In function 'define_font':
    dvi-init.c:685: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
    dvi-init.c: In function 'process_preamble':
    dvi-init.c:800: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
    events.c: In function 'drag_motion':
    events.c:3434: warning: cast to pointer from integer of different size
    events.c:3448: warning: cast to pointer from integer of different size
    events.c: In function 'Act_wheel':
    events.c:3497: warning: cast to pointer from integer of different size

    message-window.c: In function 'ok_action':
    message-window.c:248: warning: cast from pointer to integer of different size
    message-window.c: In function 'cancel_action':
    message-window.c:331: warning: cast from pointer to integer of different size
    message-window.c: In function 'create_dialogs':
    message-window.c:620: warning: cast to pointer from integer of different size
    message-window.c:662: warning: cast to pointer from integer of different size

    sfDraw.c: In function 'SFscrollTimer':
    sfDraw.c:434: warning: cast from pointer to integer of different size
    sfDraw.c:465: warning: cast to pointer from integer of different size
    sfDraw.c: In function 'SFnewInvertEntry':
    sfDraw.c:504: warning: cast to pointer from integer of different size
    pk.c: In function 'read_PK_index':
    pk.c:380: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
    sfSelFile.c: In function 'SFexposeList':
    sfSelFile.c:166: warning: cast from pointer to integer of different size
    sfSelFile.c: In function 'SFcreateWidgets':
    sfSelFile.c:560: warning: cast to pointer from integer of different size
    sfSelFile.c:562: warning: cast to pointer from integer of different size
    sfSelFile.c:576: warning: cast to pointer from integer of different size
    sfSelFile.c:578: warning: cast to pointer from integer of different size
    sfSelFile.c:718: warning: cast to pointer from integer of different size
    sfSelFile.c:720: warning: cast to pointer from integer of different size
    sfSelFile.c:722: warning: cast to pointer from integer of different size
    sfSelFile.c:724: warning: cast to pointer from integer of different size
    sfSelFile.c:726: warning: cast to pointer from integer of different size
    sfSelFile.c:728: warning: cast to pointer from integer of different size

    print-internal.c: In function 'fork_dvips':
    print-internal.c:181: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result
    print-internal.c:185: warning: ignoring return value of 'getcwd', declared with attribute warn_unused_result

    special.c: In function 'elepsf_special':
    special.c:2047: warning: comparison between signed and unsigned
    special.c: In function 'dvi2ps_color_special':
    special.c:2981: warning: unused parameter 'cp'
    special.c:2982: warning: unused parameter 'colfmt'

    special.c:2912: warning: 'cmyk_to_rgb' defined but not used
    special.c:2936: warning: 'hsb_to_rgb' defined but not used
    special.c:2965: warning: 'color_warn' defined but not used
    util.c: In function 'my_realpath':
    util.c:581: warning: ignoring return value of 'fchdir', declared with attribute warn_unused_result
    util.c:591: warning: ignoring return value of 'fchdir', declared with attribute warn_unused_result
    util.c: In function 'fork_process':
    util.c:1082: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result
    util.c:1085: warning: ignoring return value of 'getcwd', declared with attribute warn_unused_result

    util.c: In function 'find_file':
    util.c:1498: warning: ignoring return value of 'fchdir', declared with attribute warn_unused_result
    gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -W -Wall -Wunused -I.. -I./.. -DPS_GS -DXSERVER_INFO -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c xm_colorsel.c -o xm_colorsel.o
    vf.c: In function 'read_VF_index':
    vf.c:159: warning: ignoring return value of 'fread', declared with attribute warn_unused_result

    xlwradio.c:212: warning: excess elements in struct initializer
    xlwradio.c:212: warning: (near initialization for 'radioClassRec.simple_class')
    xlwradio.c: In function 'RadioClassInit':
    xlwradio.c:257: warning: implicit declaration of function 'XawInitializeWidgetSet'

    x_util.c: In function 'scroll_page_if_needed':
    x_util.c:129: warning: cast to pointer from integer of different size
    x_util.c:139: warning: cast to pointer from integer of different size

    ft2.c: In function 'glyph_to_bitmap':
    ft2.c:172: warning: pointer targets in assignment differ in signedness

     
  • Paul Vojta
    Paul Vojta
    2014-03-20

    • status: open --> closed-fixed
     
  • Paul Vojta
    Paul Vojta
    2014-03-20

    The warning messages have been cleaned up for some time now; apparently nobody remembered to close the bug.