[tlbuild] [tex-live] TL2010 pretest luatex fails on Solaris 10 sparc

Vladimir Volovich vvv at vsu.ru
Sun Jun 13 11:47:51 CEST 2010


Hi Taco,

i've sent a patch

 > -    int cattable_field:16;      /* category table used by the current line (see textoken.c) */
 > +    signed int cattable_field:16; /* category table used by the current line (see textoken.c) */

which appears to fix the broken behavior with inability to read any input.

As i said, this was happening because of the definitions

#  define  DEFAULT_CAT_TABLE -1

#define do_get_cat_code(a) do {                                         \
    if (line_catcode_table!=DEFAULT_CAT_TABLE)                          \
      a=get_cat_code(line_catcode_table,cur_chr);                       \
    else                                                                \
      a=get_cat_code(cat_code_table,cur_chr);                           \
  } while (0)

and because on Sun Studio, "int" bit-fields are unsigned by default, so
the condition line_catcode_table!=DEFAULT_CAT_TABLE is treated as
line_catcode_table != -1 and will always be true because
line_catcode_table is unsigned, so it will always call
a=get_cat_code(line_catcode_table,cur_chr), regardless of the actual
value of line_catcode_table.

declaring the cattable_field bit-field as signed allowed the condition
line_catcode_table!=DEFAULT_CAT_TABLE to be properly evaluated, so

  when line_catcode_table=DEFAULT_CAT_TABLE, do_get_cat_code(cur_cmd)
  will call cur_cmd=get_cat_code(cat_code_table,cur_chr);

  and when line_catcode_table!=DEFAULT_CAT_TABLE,
  do_get_cat_code(cur_cmd) will call
  cur_cmd=get_cat_code(line_catcode_table,cur_chr);

i don't know the inner-workings of luatex, but hopefully it will never
happen when the first argument of get_cat_code will be negative.

i.e. is the only negative value of line_catcode_table supposed to be -1?
could it happen that line_catcode_table will be > 32767 and in this case
will be treated as negative?

Best wishes,
v.


More information about the tlbuild mailing list