[gnu.gcc.bug] Suspected bug in VMS GCC 1.22

EPRF%SNYCENVM.BITNET@MITVMA.MIT.EDU (Peter Flass) (02/15/89)

Here is documentation on a compiler abend in VMS GCC 1.22.
The code is not mine.  I believe it compiled successfully using the
Whitesmiths' C compiler on the VAX, but I can't speak from personal
knowledge.  If you need any more doc., let me know.  Thanks.
        - Pete
(I hope everything made the transition from VMS to CMS with no character
 translations).
VMS GCC 1.22 Compiler Abend
The program compiles successfully when I change the line
#define PRIV_MASK_0 from '<< PRV$V_SYSPRV' to '<< 6' (arbitrary constant).

Attached:  VMS Traceback info
           source and header files
           preprocessed source

---------------------- VMS GCC Stack Dump --------------------------------
%SYSTEM-F-OPCDEC, opcode reserved to DIGITAL fault at PC=0004BFD2, PSL=03C00000
%TRACE-F-TRACEBACK, symbolic stack dump follows
module name     routine name                     line       rel PC    abs PC

GCCLIB          _FIXUNS_TRUNCDFSI                          0000000A  0004BFD2
EMIT-RTL        gen_lowpart                       420      000000C8  0002EF80
EXPR            convert_move                      559      000003A3  00022D9B
OPTABS          expand_binop                      168      00000196  0002B226
EXPMED          store_split_bit_field             975      00000A17  00029D8D
EXPR            emit_push_insn                   2548      00001A5E  00024F2C
EXPR            emit_push_insn                   2525      000019EB  00024EB9
EXPR            preexpand_calls                  4011      00000FE1  0002677F
EXPR            preexpand_calls                  3857      00000D94  00026532
STMT            expand_start_cond                 687      00000061  00026EB1
PARSE_TAB       yyparse                           845      0000101F  00010C97
TOPLEV          compile_file                      793      0000052C  0000B880
TOPLEV          main                             1492      00000635  0000CC6D
----------------------- Source being compiled ---------------------------
# include    "protocol.h"
# include    "common.h"
# include    "vms.h"

extern char prv$v_sysprv[];
# define    PRV$V_SYSPRV    (int)prv$v_sysprv

# define    PRIV_MASK_0    (1L << PRV$V_SYSPRV)
# define    PRIV_MASK_1    0L

int chk_opr_prv()
    {
    struct
    {
    short    j_buffer_length;
    short    j_item_code;
    long    *j_buffer_address;
    short    *j_return_length_address;
    long    j_zero;
    } j;
    long procpriv[2];

    j.j_buffer_length = 8;
    j.j_item_code = JPI$_PROCPRIV;
    j.j_buffer_address = procpriv;
    j.j_return_length_address = 0;
    j.j_zero = 0;

    sys$getjpi(0, 0, 0, &j, 0, 0, 0);
    if ( ! (procpriv[0] & PRIV_MASK_0))
        return (FAILURE);
    else
        return (SUCCESS);
    }
--------------- protocol.h ------------------------------------------
/* protocol.h  Date  1-Nov-1984  Edit  7 */
/*++
    *************************************************

             Copyright (C) 1983
                by
     Software Results Corporation, Columbus, Ohio, USA

 This software is furnished under a license and may be used and  copied
 only  in  accordance  with  the  terms  of  such  license and with the
 inclusion of the above copyright notice.  This software or  any  other
 copies  thereof may not be provided or otherwise made available to any
 other person.  No title to and ownership of  the  software  is  hereby
 transferred.

 The information in this software is subject to change  without  notice
 and  should  not  be  construed  as  a  commitment by Software Results
 Corporation.

    *************************************************
--*/
# define    P_HASP

# define    P_NAME    "HASP"
# define    P_LCNAME    "hasp"

/* # define    SINGLE_CHANNEL */
/* # define    REMOTE    */

------------------- common.h -------------------------------------------
/* common.h  Date  19-Apr-1985  Edit  18 */
/*++
    *************************************************

             Copyright (C) 1983
                by
     Software Results Corporation, Columbus, Ohio, USA

 This software is furnished under a license and may be used and  copied
 only  in  accordance  with  the  terms  of  such  license and with the
 inclusion of the above copyright notice.  This software or  any  other
 copies  thereof may not be provided or otherwise made available to any
 other person.  No title to and ownership of  the  software  is  hereby
 transferred.

 The information in this software is subject to change  without  notice
 and  should  not  be  construed  as  a  commitment by Software Results
 Corporation.

    *************************************************
--*/
/*++

 Module name:    none
 File name:    DEV$V51:[INDEP.UTIL]COMMON.H

 Product:    Independent Code for RJE/COMBOARD

 Module history:
    When        Who    What
    26-Apr-1983    KFF    Created
        19-Apr-1985    KJ Ruble Added MAX_STRLEN for UNIX

 Module Purpose:
    Define commonly used constants and types.

 Calling sequence:    none.

 Called by:        nobody.

 Calls:            nobody.

 Input arguments:    none.

 Output values:        none.

 Side Effects:        none

 Externals:        none.

 Files referenced:    none.

 Possible errors:    none

 Things which need to be done:
            nothing

 Remarks:

    ***********************************************

            Module Design Description


    *************************************************
--*/

# ifdef vms
# define    STR_LEN        255
# else
# define    STR_LEN        132
# endif

# ifdef UNIX
# define    MAX_STRLEN    100   /* Unix printf can't handle buffer */
                                      /* size > 128,so leave a few for   */
                                      /* printing extras in addition to  */
                                      /* operator entered stuff          */
# endif

# define    FAILURE        0
# define    SUCCESS        1
# define    BROKEN        2
# define    END_OF_FILE    3
# define    TRUNCATED    4

# define    READ        0
# define    WRITE        1

typedef int set;

typedef int boolean;
# define    FALSE    (boolean)0
# define    TRUE    (boolean)1

---------------------- vms.h --------------------------------------
/* vms.h  Date  21-Jan-1983  Edit  81 */
/*++
    *************************************************

             Copyright (C) 1983
                by
     Software Results Corporation, Columbus, Ohio, USA

 This software is furnished under a license and may be used and  copied
 only  in  accordance  with  the  terms  of  such  license and with the
 inclusion of the above copyright notice.  This software or  any  other
 copies  thereof may not be provided or otherwise made available to any
 other person.  No title to and ownership of  the  software  is  hereby
 transferred.

 The information in this software is subject to change  without  notice
 and  should  not  be  construed  as  a  commitment by Software Results
 Corporation.

    *************************************************
--*/

extern char ss$_normal[];
# define    SS$_NORMAL    (int)ss$_normal
extern char ss$_cancel[];
# define    SS$_CANCEL    (int)ss$_cancel
extern char ss$_abort[];
# define    SS$_ABORT    (int)ss$_abort
extern char ss$_badescape[];
# define    SS$_BADESCAPE    (int)ss$_badescape
extern char ss$_partescape[];
# define    SS$_PARTESCAPE    (int)ss$_partescape
extern char ss$_nomoreproc[];
# define    SS$_NOMOREPROC    (int)ss$_nomoreproc
extern char ss$_endoffile[];
# define    SS$_ENDOFFILE    (int)ss$_endoffile
extern char ss$_nosuchdev[];
# define    SS$_NOSUCHDEV    (int)ss$_nosuchdev
extern char ss$_devalloc[];
# define    SS$_DEVALLOC    (int)ss$_devalloc
extern char ss$_nopriv[];
# define    SS$_NOPRIV    (int)ss$_nopriv

extern char io$m_now[];
# define    IO$M_NOW    (int)io$m_now
extern char io$_sensemode[];
# define    IO$_SENSEMODE    (int)io$_sensemode
extern char io$_setmode[];
# define    IO$_SETMODE    (int)io$_setmode
extern char io$_readpblk[];
# define    IO$_READPBLK    (int)io$_readpblk
extern char io$_writepblk[];
# define    IO$_WRITEPBLK    (int)io$_writepblk
extern char io$_readvblk[];
# define    IO$_READVBLK    (int)io$_readvblk
extern char io$_writevblk[];
# define    IO$_WRITEVBLK    (int)io$_writevblk
extern char io$m_noecho[];
# define    IO$M_NOECHO    (int)io$m_noecho
extern char io$m_nofiltr[];
# define    IO$M_NOFILTR    (int)io$m_nofiltr

extern char jpi$_prcnam[];
# define    JPI$_PRCNAM    (int)jpi$_prcnam
extern char jpi$_uic[];
# define    JPI$_UIC    (int)jpi$_uic
extern char jpi$_procpriv[];
# define    JPI$_PROCPRIV    (int)jpi$_procpriv
extern char jpi$_terminal[];
# define    JPI$_TERMINAL    (int)jpi$_terminal
extern char jpi$_username[];
# define    JPI$_USERNAME    (int)jpi$_username

extern char tt$m_passall[];
# define    TT$M_PASSALL    (int)tt$m_passall
extern char tt$m_noecho[];
# define    TT$M_NOECHO    (int)tt$m_noecho
extern char tt$m_escape[];
# define    TT$M_ESCAPE    (int)tt$m_escape
extern char tt$m_wrap[];
# define    TT$M_WRAP    (int)tt$m_wrap
extern char tt$m_scope[];
# define    TT$M_SCOPE    (int)tt$m_scope

struct vax_string
    {
    int v_length;
    char *v_text;
    };

/*
 *    A descriptor block of the form required by dclexh().
 */
struct desblk
    {
    struct desblk *d_forward_link;
    int (*d_exit_handler_address)();
    unsigned char d_nargs;
    unsigned char d_pad[3];
    long *d_reason_address;
    long d_arguments[1];
    };

-------------- Preprocessed source -------------------------------
# 1 "checkpriv.c"
# 1 "protocol.h"




























# 1 "checkpriv.c"

# 1 "common.h"

























































































typedef int set;

typedef int boolean;


# 2 "checkpriv.c"

# 1 "vms.h"






















extern char ss$_normal[];

extern char ss$_cancel[];

extern char ss$_abort[];

extern char ss$_badescape[];

extern char ss$_partescape[];

extern char ss$_nomoreproc[];

extern char ss$_endoffile[];

extern char ss$_nosuchdev[];

extern char ss$_devalloc[];

extern char ss$_nopriv[];


extern char io$m_now[];

extern char io$_sensemode[];

extern char io$_setmode[];

extern char io$_readpblk[];

extern char io$_writepblk[];

extern char io$_readvblk[];

extern char io$_writevblk[];

extern char io$m_noecho[];

extern char io$m_nofiltr[];


extern char jpi$_prcnam[];

extern char jpi$_uic[];

extern char jpi$_procpriv[];

extern char jpi$_terminal[];

extern char jpi$_username[];


extern char tt$m_passall[];

extern char tt$m_noecho[];

extern char tt$m_escape[];

extern char tt$m_wrap[];

extern char tt$m_scope[];


struct vax_string
    {
    int v_length;
    char *v_text;
    };




struct desblk
    {
    struct desblk *d_forward_link;
    int (*d_exit_handler_address)();
    unsigned char d_nargs;
    unsigned char d_pad[3];
    long *d_reason_address;
    long d_arguments[1];
    };
# 3 "checkpriv.c"


extern char prv$v_sysprv[];





int chk_opr_prv()
    {
    struct
    {
    short    j_buffer_length;
    short    j_item_code;
    long    *j_buffer_address;
    short    *j_return_length_address;
    long    j_zero;
    } j;
    long procpriv[2];

    j.j_buffer_length = 8;
    j.j_item_code = (int)jpi$_procpriv ;
    j.j_buffer_address = procpriv;
    j.j_return_length_address = 0;
    j.j_zero = 0;

    sys$getjpi(0, 0, 0, &j, 0, 0, 0);
    if ( ! (procpriv[0] & (1L << (int)prv$v_sysprv ) ))
        return (    0 );
    else
        return (    1 );
    }


+-----------------------------------------------------------------------------+
|                                                                             |
|    Peter Flass                       BITnet:   EPRF@SNYCENVM (preferred)    |
|    Director of Computing Services    INTERnet: ESCFLASS@UBVM.CC.BUFFALO.EDU |
|    SUNY Empire State College         AT&Tnet:  (518)587-2100 X350           |
|    2 Union Avenue                                                           |
|    Saratoga Springs  NY  12866       "this space for rent"                  |
|                                                                             |
+-----------------------------------------------------------------------------+