home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / hp / 12996 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.5 KB  |  52 lines

  1. Newsgroups: comp.sys.hp
  2. Path: sparky!uunet!mcsun!news.funet.fi!network.jyu.fi!tarzan!tt
  3. From: tt@tarzan.jyu.fi (Tapani Tarvainen)
  4. Subject: cc -N bug?
  5. Message-ID: <TT.92Nov17151405@tarzan.jyu.fi>
  6. Originator: tt@tarzan.math.jyu.fi
  7. Sender: news@jyu.fi (News articles)
  8. Nntp-Posting-Host: tarzan.math.jyu.fi
  9. Organization: University of Jyvaskyla
  10. Date: Tue, 17 Nov 1992 13:14:05 GMT
  11. Lines: 39
  12.  
  13. When I compile the appended little program (it's byteorder.c from
  14. recent tripwire distribution) in our HP9000/720 running HP-UX 8.07
  15. with the command "cc -N -Wl,-a,archive" it compiles without complaints
  16. (except one "warning 951: Shift of 32 bits or more.") and produces a
  17. normal-looking executable ('file' confirms it's "PA-RISC1.1 executable
  18. -not stripped"), but when I try to execute it, I get "cannot execute"
  19. -- or if use sh, I get "syntax error at line 1: `8AT^AP^G^Bªq^P^D'
  20. unexpected" as if it thinks it is a shell script.  Without the -N
  21. option it works fine.  And the problem doesn't occur in a 9000/425e.
  22. Have I done something stupid or is there a bug in the compiler or what?
  23.  
  24. The compiler versio (by what) is "HP92453-01 A.08.71 HP C Compiler".
  25.  
  26.  
  27. main()
  28. {
  29.     int i;
  30.     union {
  31.     unsigned long l;
  32.     char c[sizeof(long)];
  33.     } u;
  34.  
  35.     if (sizeof(long) > 4)
  36.     u.l = (0x08070605L << 32) | 0x04030201L;
  37.     else
  38.     u.l = 0x04030201L;
  39.  
  40.     (void)printf("#define BYTEORDER 0x");
  41.     for (i=0; i < sizeof(long); i++)
  42.     (void)printf("%c",u.c[i]+'0');
  43.     (void)printf("\n");
  44.  
  45.     exit(0);
  46.     /*NOTREACHED*/
  47. }
  48.  
  49.  
  50. --
  51. Tapani Tarvainen  (tt@math.jyu.fi, tarvainen@finjyu.bitnet)
  52.