Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Steven L Baur <steve@miranova.com>
To: jps@quarry.zk3.dec.com (Jeff Sullivan USG),ici@osk.threewebnet.or.jp
Subject: Re: compiler internal error in building xemacs-20.x
Date: 1997/05/01	[thread overview]
Message-ID: <m24tcnyqu2.fsf@altair.xemacs.org> (raw)
In-Reply-To: 5kadds$dhe$1@nntpd.lkg.dec.com


Major question:  Does this compiler internal error still happen if the 
configuration option `use-union-type=yes' is used?


Jeff Sullivan USG <jps@quarry.zk3.dec.com> writes:

> We were able to reproduce the problem and are now investigating a
> compiler fix. There appears to be a problem in the xemacs abbrev.c
> source code, given the preprocessed file that you sent us.

> Below is the (simplified) code that is causing the compiler error:

> int SYNTAX_CODE (struct Lisp_Char_Table *table, int c) {
>     return ((((c) < 160 ? (table)->ascii[c] :
>               CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (table, c))).val);
> }

This appears to be the expansion of the macro

#define CHAR_TABLE_VALUE_UNSAFE(ct, ch)		\
  ((ch) < NUM_ASCII_CHARS			\
   ? (ct)->ascii[ch]				\
   : CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (ct, ch))

in chartab.h.  NUM_ASCII_CHARS is 160 when compiled with MULE.  This
macro should return type Lisp_Object, as the ascii field is an array
of Lisp_Object,

struct Lisp_Char_Table
{
  struct lcrecord_header header;

  Lisp_Object ascii[NUM_ASCII_CHARS];

#ifdef MULE
  Lisp_Object level1[NUM_LEADING_BYTES];

#endif /* MULE */

  enum char_table_type type;

  /* stuff used for syntax tables */
  Lisp_Object mirror_table;
  Lisp_Object next_table; /* DO NOT mark through this. */
};

and the macro CHAR_TABLE_NON_ASCII_VALUE_UNSAFE similarly returns
type Lisp_Object.

INLINE Lisp_Object
CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (struct Lisp_Char_Table *ct, Emchar ch)
{
  unsigned char lb = CHAR_LEADING_BYTE (ch);
  if (!CHAR_TABLE_ENTRYP ((ct)->level1[lb - MIN_LEADING_BYTE]))
    return (ct)->level1[lb - MIN_LEADING_BYTE];
  else
    return get_non_ascii_char_table_value (ct, lb, ch);
}

Lisp_Object get_non_ascii_char_table_value (struct Lisp_Char_Table *ct,
					   int leading_byte,
					   Emchar c);

> There appears to be a few problems with this:
   
>      - the function returns "int" (in the original)

Yes, but it is converted to int in syntax.h:

#define SYNTAX_CODE_UNSAFE(table, c) \
   XINT (CHAR_TABLE_VALUE_UNSAFE (table, c))

INLINE int SYNTAX_CODE (struct Lisp_Char_Table *table, Emchar c);
INLINE int
SYNTAX_CODE (struct Lisp_Char_Table *table, Emchar c)
{
  return SYNTAX_CODE_UNSAFE (table, c);
}

XINT is #defined from XREALINT in lisp.h.

#define XINT(obj) XREALINT (obj)

The implementation of XREALINT depends on whether lisp unions are
used.  The following definition is used if lisp unions are not used.

# define XREALINT(a) (((a) << (LONGBITS-VALBITS)) >> (LONGBITS-VALBITS))

>      - (table)->ascii[c] is of type "Lisp_Object"
>      - CHAR_TABLE_NON_ASCII_VALUE_UNSAFE (table, c))).val
>        is of type "long"

This may be confusion from not compiling with Lisp_Object as a union.

> To see the a compilation error (not internal error), try:

> FIX1 : Change the function to return "Lisp_Object"
>        A compile error is generated for the conditional expression
>        (I think this is acceptable)

> FIX2 : Change the conditional expression to an if/then/else
>        A compile error is generated for the returns, since the
>        types do not match "int".
>        (I think this is acceptable)

> Note that with either of these "fixes", it will point to a
> real source code problem and ultimately, the source code should
> be fixed.

O.K.

> If you could, please send me a non-preprocessed version of this
> same file/routine, so we can determine how the source code should
> be changed.

It's difficult to impossible to separate this stuff apart given the
heavy (over)use of macros.  The full source code is at
ftp://ftp.xemacs.org/pub/beta/xemacs-20.2/.  Perhaps Ishiisan can tar
up a copy of his src directory after running configure and creating
src/config.h and src/Makefile (I can't -- I have no access to this
architecture).

-- 
steve@miranova.com baur
Unsolicited commercial e-mail will be billed at $250/message.



  reply	other threads:[~1997-05-01  4:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-25  4:00 compiler internal error in building xemacs-20.x Toshinao Ishii
     [not found] ` <m2n2qnx96y.fsf@altair.xemacs.org>
1997-04-28  4:00   ` Joe Mario
1997-05-01  4:00 ` Jeff Sullivan USG
1997-05-01  4:00   ` Steven L Baur [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-05-12  4:00 Joe Mario
1997-05-14  4:00 ` Steven L Baur
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox