This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to define target-specific PSImode?


Bug 42310 has been added to the database
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42310
Thank you very much!

Below is a copy of the bug report:

The exact version of GCC: 4.4.1

The system type: Linux version 2.6.9-67.EL (Red Hat 3.4.6-8)

The options given when GCC was configured/built: ../../gcc/configure
--target=testtarget --prefix=/usr/local/testtarget
--enable-target-optspace --enable-checking --disable-nls
--enable-languages=c,c++
Thread model: single

The complete command line that triggers the bug: testtarget-gcc -c loop.c

I'm trying to define a nonstandard type for 12-bit scalar variables
based on a target-dependent PSI mode.

In my backend's testtarget-modes.def I have:
  PARTIAL_INT_MODE (SI);

In my backend's testtarget_init_builtins() function
(TARGET_INIT_BUILTINS) I have the following:
  /* Create builtin type for 12-bit integer numbers (partial int) */
  tree t = make_unsigned_type (9);
  (*lang_hooks.types.register_builtin_type) (t, "mybit12_t");
  SET_TYPE_MODE (t, PSImode);

the compiler output:
testtarget-gcc: Internal error: Segmentation fault (program cc1)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

The resulting gcc compiler crashes (ICE) when it tries to convert any
integer into my new type.
I tried to debug it and what I see is that it goes back and forth
until the stack is exhausted between two functions: convert and
convert_to_integer:

#0  convert_to_integer (type=0xb7eb20d0, expr=0xb7e3caf0) at
../../../gcc/gcc/convert.c:389
#1  0x08079974 in convert (type=0xb7eb20d0, expr=0xb7e3caf0) at
../../../gcc/gcc/c-convert.c:101
#2  0x08080edc in convert_and_check (type=0xb7eb20d0, expr=0xb7e3caf0)
at ../../../gcc/gcc/c-common.c:1812
#3  0x08068c5c in convert_for_assignment (type=0xb7eb20d0,
rhs=0xb7e3caf0, errtype=ic_assign, fundecl=0x0, function=0x0,
parmnum=0) at ../../../gcc/gcc/c-typeck.c:4212
#4  0x080720b6 in build_modify_expr (location=1619, lhs=0xb7ec0000,
modifycode=NOP_EXPR, rhs=0xb7e3caf0) at
../../../gcc/gcc/c-typeck.c:3948
#5  0x080a984c in c_parser_expr_no_commas (parser=0xb7ebe0fc,
after=0x0) at ../../../gcc/gcc/c-parser.c:4421
#6  0x080a9914 in c_parser_expression (parser=0xb7e3caf0) at
../../../gcc/gcc/c-parser.c:5664
#7  0x080af9fd in c_parser_for_statement (parser=0xb7ebe0fc) at
../../../gcc/gcc/c-parser.c:4101
#8  0x080a63de in c_parser_statement_after_labels (parser=0xb7ebe0fc)
at ../../../gcc/gcc/c-parser.c:3700
#9  0x080a71b5 in c_parser_compound_statement_nostart
(parser=0xb7ebe0fc) at ../../../gcc/gcc/c-parser.c:3470
#10 0x080aec1b in c_parser_compound_statement (parser=0xb7ebe0fc) at
../../../gcc/gcc/c-parser.c:3318
#11 0x080af1e7 in c_parser_declaration_or_fndef (parser=0xb7ebe0fc,
fndef_ok=1 '\001', empty_ok=1 '\001', nested=0 '\0',
start_attr_ok=Variable "start_attr_ok" is not available.
) at ../../../gcc/gcc/c-parser.c:1307
#12 0x080b0e95 in c_parser_external_declaration (parser=0xb7ebe0fc) at
../../../gcc/gcc/c-parser.c:1076
#13 0x080b1c79 in c_parse_file () at ../../../gcc/gcc/c-parser.c:979
#14 0x0809af6c in c_common_parse_file (set_yydebug=0) at
../../../gcc/gcc/c-opts.c:1252
#15 0x0832a409 in toplev_main (argc=12, argv=0xbff91014) at
../../../gcc/gcc/toplev.c:970
#16 0x080bddb7 in main (argc=12, argv=0xbff91014) at ../../../gcc/gcc/main.c:35

The preprocessed file that triggers the bug:
int main (int argc, char *argv[]) {
  mybit12_t i;
  for (i = 0; i < 20; i++)
    printf ("%d", i);
  return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]