[Simh] Bug report???? Some ld errors and warnings when compiled with Intel icc on a Mac Yosmite

Mark Pizzolato - Info Comm Mark at infocomm.com
Mon Feb 9 14:53:27 EST 2015


Hi Clem,

New compilers often identify subtle issues.  Sometimes they find real bugs as well.

Looking over the issues below:

The cpu_idle_mask and the sim_vm_init look to be the same issue occurring in different places in the code.  The cpu_idle_mask is due to a recent change and I can probably make it go away with a minor change.  I’m not sure that there isn’t an ICC compiler issue which these cases illuminate anyway.

The issue is that the same global variable is declared in more than one source module.  Declared in this case is a declaration WITHOUT an ‘extern’ modifier.  In all other compilers I’ve ever seen declaring the same variable (without extern) in more than one module is benign and those multiple declarations will ultimately refer to the same storage once the linker glues everything together.  The only restriction here is that ONLY one of these multiple declarations can provide an initialization value for that variable.

Simh counts on this mechanism to provide a ‘weak global’ reference to the sim_vm_init routine.  Some simulators (the ones you identified) provide a sim_vm_init routine and scp.c calls it when the simulator starts if the pointer variable has is not NULL.  Scp.c has the following declaration:

void (*sim_vm_init) (void);

if this declaration was prefixed by ‘extern’, this would become a strong global reference and any simulator which didn’t explicitly declare sim_vm_init someplace would get a hard linker error.

From the ld error message, it seems that ICC is mostly doing the right thing, but it somehow has the size wrong for either the place where it is defined without a value or the place where it has a value.

I’m thinking that the DP_DRV cases might also be a ICC compiler bug.
It seems that ICC doesn’t like some macro concatenation activities, but correctly handles others:

It doesn’t like:

#define DP_DRV(d) \
    #d, \
    UNIT_##d, CYL_##d, SURF_##d, CAP_##d, \
    UMSK_##d, HMSK_##d, CMSK_##d, WRDS_##d

While it has no problem with:

#define RQ_DRV(d) \
  { d##_SECT, d##_SURF, d##_CYL,  d##_TPG, \
    d##_GPC,  d##_XBN,  d##_DBN,  d##_LBN, \
    d##_RCTS, d##_RCTC, d##_RBN,  d##_MOD, \
    d##_MED, d##_FLGS, #d }

Dave Bryan has commented on the HP2100 issues.


-          Mark

From: Clem Cole [mailto:clemc at ccc.com]
Sent: Monday, February 09, 2015 11:05 AM
To: Mark Pizzolato - Info Comm; Bob Supnik
Cc: simh at trailing-edge.com
Subject: Bug report???? Some ld errors and warnings when compiled with Intel icc on a Mac Yosmite

Mark/Bob,

Note sure if you care but for grins and giggles I put simh through the new Intel C compiler.   It compiles clean with the default clang from Apple, but icc (which you may know is the moral replacement for the old DEC compiler is having some issues [icc is the DEC compiler DNA ground up an reinjected]).  Note I have not played with the results yet, but I wanted to dash this off before I lost it case you care.

BTW: do you have a "benchmark" of any type.  Be curious to know how ICC is doing compared to other compilers.  I was messing with snobol over the holidays and noticed a performance regression I so I mentioned to our old mates in the compiler team and that are interested in find it.   If you have something I'll try to run it and if we notice any difference from gcc or clang I'll put in a performance regression bug report.

Clem



When I link: microvax3900, microvax1, or rtvax1000,  I'm seeing an error from ld WRT cpu_idle_mask:

ld: warning: tentative definition of '_cpu_idle_mask' with size 16 from '/var/folders/g8/c60w3j2924v_3gjch8__czwntmrjwb/T/icckYYP3U.o' is being replaced by real definition of smaller size 4 from '/var/folders/g8/c60w3j2924v_3gjch8__czwntmrjwb/T/iccDHTDW0.o'



ie:

icc -std=c99 -U__STRICT_ANSI__  -O2 -DSIM_GIT_COMMIT_ID=960b22d93079ba8babd2d9ded5e54cf9dcc6a2c6 -DSIM_COMPILER="" -I . -D_GNU_SOURCE -DUSE_READER_THREAD -DSIM_ASYNCH_IO  -DHAVE_PCREPOSIX_H -DHAVE_DLOPEN=dylib -DHAVE_GLOB  VAX/vax_cpu.c VAX/vax_cpu1.c VAX/vax_fpa.c VAX/vax_io.c VAX/vax_cis.c VAX/vax_octa.c  VAX/vax_cmode.c VAX/vax_mmu.c VAX/vax_stddev.c VAX/vax_sysdev.c VAX/vax_sys.c  VAX/vax_syscm.c VAX/vax_syslist.c VAX/vax_vc.c VAX/vax_lk.c VAX/vax_vs.c VAX/vax_2681.c PDP11/pdp11_rl.c PDP11/pdp11_rq.c PDP11/pdp11_ts.c PDP11/pdp11_dz.c PDP11/pdp11_lp.c PDP11/pdp11_tq.c PDP11/pdp11_xq.c PDP11/pdp11_vh.c PDP11/pdp11_cr.c PDP11/pdp11_io_lib.c scp.c sim_console.c sim_fio.c sim_timer.c sim_sock.c sim_tmxr.c sim_ether.c sim_tape.c sim_disk.c sim_serial.c sim_video.c sim_imd.c -DVM_VAX -DUSE_INT64 -DUSE_ADDR64 -DUSE_SIM_VIDEO -I VAX -I PDP11 -DHAVE_PCAP_NETWORK -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/ -DBPF_CONST_STRING -DUSE_SHARED   -o BIN/microvax3900 -lm -lpthread -lpcreposix -ldl


with HP2100/hp2100_defs.h is generating some unrecognized #pragma warnings as lines 96, 97 & 98:

ie:

In file included from HP2100/hp2100_stddev.c(118):
HP2100/hp2100_defs.h(96): warning #161: unrecognized #pragma
  #pragma clang diagnostic ignored "-Wlogical-op-parentheses"
          ^

In file included from HP2100/hp2100_stddev.c(118):
HP2100/hp2100_defs.h(97): warning #161: unrecognized #pragma
  #pragma clang diagnostic ignored "-Wbitwise-op-parentheses"
          ^

In file included from HP2100/hp2100_stddev.c(118):
HP2100/hp2100_defs.h(98): warning #161: unrecognized #pragma
  #pragma clang diagnostic ignored "-Wdangling-else"
           ^
Obviously repeated in the files that include it.

Anyway when I link: altairz80, ibm1130  I'm seeing a similar error from ld WRT sim_vm_init:

icc -std=c99 -U__STRICT_ANSI__  -O2 -DSIM_GIT_COMMIT_ID=960b22d93079ba8babd2d9ded5e54cf9dcc6a2c6 -DSIM_COMPILER="" -I . -D_GNU_SOURCE -DUSE_READER_THREAD -DSIM_ASYNCH_IO  -DHAVE_PCREPOSIX_H -DHAVE_DLOPEN=dylib -DHAVE_GLOB  AltairZ80/altairz80_cpu.c AltairZ80/altairz80_cpu_nommu.c AltairZ80/altairz80_dsk.c AltairZ80/disasm.c AltairZ80/altairz80_sio.c AltairZ80/altairz80_sys.c AltairZ80/altairz80_hdsk.c AltairZ80/altairz80_net.c AltairZ80/flashwriter2.c AltairZ80/i86_decode.c AltairZ80/i86_ops.c AltairZ80/i86_prim_ops.c AltairZ80/i8272.c AltairZ80/insnsd.c AltairZ80/altairz80_mhdsk.c AltairZ80/mfdc.c AltairZ80/n8vem.c AltairZ80/vfdhd.c AltairZ80/s100_disk1a.c AltairZ80/s100_disk2.c AltairZ80/s100_disk3.c AltairZ80/s100_fif.c AltairZ80/s100_mdriveh.c AltairZ80/s100_mdsad.c AltairZ80/s100_selchan.c AltairZ80/s100_ss1.c AltairZ80/s100_64fdc.c AltairZ80/s100_scp300f.c AltairZ80/wd179x.c AltairZ80/s100_hdc1001.c AltairZ80/s100_if3.c AltairZ80/s100_adcs6.c AltairZ80/m68kcpu.c AltairZ80/m68kdasm.c AltairZ80/m68kopac.c AltairZ80/m68kopdm.c AltairZ80/m68kopnz.c AltairZ80/m68kops.c AltairZ80/m68ksim.c scp.c sim_console.c sim_fio.c sim_timer.c sim_sock.c sim_tmxr.c sim_ether.c sim_tape.c sim_disk.c sim_serial.c sim_video.c sim_imd.c -I AltairZ80 -DUSE_SIM_IMD -o BIN/altairz80 -lm -lpthread -lpcreposix -ldl
ld: warning: tentative definition of '_sim_vm_init' with size 16 from '/var/folders/g8/c60w3j2924v_3gjch8__czwntmrjwb/T/icct7a3Lu.o' is being replaced by real definition of smaller size 8 from '/var/folders/g8/c60w3j2924v_3gjch8__czwntmrjwb/T/iccmecicr.o'

with H316/h316_dp.c in line 215, 216, 27 is generating some warnings about concatenation macro "DP_DRV" [not creating a valid token]

ie.


icc -std=c99 -U__STRICT_ANSI__  -O2 -DSIM_GIT_COMMIT_ID=960b22d93079ba8babd2d9ded5e54cf9dcc6a2c6 -DSIM_COMPILER="" -I . -D_GNU_SOURCE -DUSE_READER_THREAD -DSIM_ASYNCH_IO  -DHAVE_PCREPOSIX_H -DHAVE_DLOPEN=dylib -DHAVE_GLOB  H316/h316_stddev.c H316/h316_lp.c H316/h316_cpu.c H316/h316_sys.c H316/h316_mt.c H316/h316_fhd.c H316/h316_dp.c H316/h316_rtc.c H316/h316_imp.c H316/h316_hi.c H316/h316_mi.c H316/h316_udp.c  scp.c sim_console.c sim_fio.c sim_timer.c sim_sock.c sim_tmxr.c sim_ether.c sim_tape.c sim_disk.c sim_serial.c sim_video.c sim_imd.c -I H316 -D VM_IMPTIP -o BIN/h316 -lm -lpthread -lpcreposix -ldl
H316/h316_dp.c(215): warning #2358: concatenation with "4651" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4651) },
        ^

H316/h316_dp.c(215): warning #2358: concatenation with "4651" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4651) },
        ^

H316/h316_dp.c(215): warning #2358: concatenation with "4651" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4651) },
        ^

H316/h316_dp.c(215): warning #2358: concatenation with "4651" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4651) },
        ^

H316/h316_dp.c(215): warning #2358: concatenation with "4651" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4651) },
        ^

H316/h316_dp.c(215): warning #2358: concatenation with "4651" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4651) },
        ^

H316/h316_dp.c(215): warning #2358: concatenation with "4651" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4651) },
        ^

H316/h316_dp.c(215): warning #2358: concatenation with "4651" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4651) },
        ^

H316/h316_dp.c(216): warning #2358: concatenation with "4623" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4623) },
        ^

H316/h316_dp.c(216): warning #2358: concatenation with "4623" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4623) },
        ^

H316/h316_dp.c(216): warning #2358: concatenation with "4623" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4623) },
        ^

H316/h316_dp.c(216): warning #2358: concatenation with "4623" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4623) },
        ^

H316/h316_dp.c(216): warning #2358: concatenation with "4623" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4623) },
        ^

H316/h316_dp.c(216): warning #2358: concatenation with "4623" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4623) },
        ^

H316/h316_dp.c(216): warning #2358: concatenation with "4623" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4623) },
        ^

H316/h316_dp.c(216): warning #2358: concatenation with "4623" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4623) },
        ^

H316/h316_dp.c(217): warning #2358: concatenation with "4720" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4720) }
        ^

H316/h316_dp.c(217): warning #2358: concatenation with "4720" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4720) }
        ^

H316/h316_dp.c(217): warning #2358: concatenation with "4720" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4720) }
        ^

H316/h316_dp.c(217): warning #2358: concatenation with "4720" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4720) }
        ^

H316/h316_dp.c(217): warning #2358: concatenation with "4720" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4720) }
        ^

H316/h316_dp.c(217): warning #2358: concatenation with "4720" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4720) }
        ^

H316/h316_dp.c(217): warning #2358: concatenation with "4720" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4720) }
        ^

H316/h316_dp.c(217): warning #2358: concatenation with "4720" in macro "DP_DRV" does not create a valid token
      { DP_DRV (4720) }
        ^

Some details in case you care:

I cloned the github repository last night.  My system is a Macbook Pro Yosemite (10.10.2).

% icc --version
icc (ICC) 15.0.1 20141022
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20150209/b8d2e386/attachment-0001.html>


More information about the Simh mailing list