public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/55210] cannot use macro #define FOO 'a' in a conditional Date: Mon, 05 Nov 2012 15:32:00 -0000 [thread overview] Message-ID: <bug-55210-4-u3jgpTNjeP@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-55210-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55210 Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-11-05 CC| |burnus at gcc dot gnu.org Ever Confirmed|0 |1 --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-11-05 15:32:24 UTC --- If fails in cpp_interpret_string at 1426 if (!APPLY_CONVERSION (cvt, base, p - base, &tbuf)) Because "func" is a NULL pointer: (gdb) p cvt $13 = {func = 0x0, cd = 0x0, width = 0} Backtrace: #0 cpp_interpret_string (pfile=pfile@entry=0x15d9a90, from=from@entry=0x15da320, count=count@entry=1, to=to@entry=0x7fffffffd1c0, type=<optimized out>) at /home/tob/projects/gcc-git/gcc/libcpp/charset.c:1426 #1 0x0000000000e71b7d in cpp_interpret_charconst (pfile=0x15d9a90, token=0x15da318, pchars_seen=0x7fffffffd30c, unsignedp=0x7fffffffd3f0) at /home/tob/projects/gcc-git/gcc/libcpp/charset.c:1615 #2 0x0000000000e5fe85 in eval_token (virtual_location=4868, token=0x15da318, pfile=0x15d9a90) at /home/tob/projects/gcc-git/gcc/libcpp/expr.c:964 #3 _cpp_parse_expr (pfile=<optimized out>, is_if=<optimized out>) at /home/tob/projects/gcc-git/gcc/libcpp/expr.c:1150 #4 0x0000000000e599b4 in do_if (pfile=0x15d9a90) at /home/tob/projects/gcc-git/gcc/libcpp/directives.c:1953 #5 0x0000000000e5b1b1 in _cpp_handle_directive (pfile=0x15d9a90, indented=<optimized out>) at /home/tob/projects/gcc-git/gcc/libcpp/directives.c:492 #6 0x0000000000e6ea6f in _cpp_scan_out_logical_line (pfile=pfile@entry=0x15d9a90, macro=macro@entry=0x0) at /home/tob/projects/gcc-git/gcc/libcpp/traditional.c:635 #7 0x0000000000e6ef6a in _cpp_read_logical_line_trad (pfile=0x15d9a90) at /home/tob/projects/gcc-git/gcc/libcpp/traditional.c:306 #8 0x000000000056fa20 in scan_translation_unit_trad (pfile=<optimized out>) at /home/tob/projects/gcc-git/gcc/gcc/fortran/cpp.c:773 The cvt variable is set via a call to "converter_for_type" with the argument type=CPP_CHAR. The function contains: 1346 switch (type) 1347 { 1348 default: 1349 return pfile->narrow_cset_desc; (and also handles CPP_UTF8STRING, CPP_CHAR16, CPP_CHAR32, CPP_WCHAR and CPP_WSTRING). The CPP_CHAR is probably generated in lex.c's lex_string The function narrow_cset_desc should get set via: cpp_init_iconv (cpp_reader *pfile) which has: pfile->narrow_cset_desc = init_iconv_desc (pfile, ncset, SOURCE_CHARSET); where "nset" gets set via: const char *ncset = CPP_OPTION (pfile, narrow_charset); If one calls "cpp" for the file (which matches calling "cc1 -E"), the type is also CPP_CHAR, but pfile->narrow_cset_desc alias cvt.func is convert_no_conversion. * * * I wonder whether one should call cpp_init_iconv - as C/C++ does in ../gcc/c-family/c-opts.c's c_common_init: /* Set up preprocessor arithmetic. Must be done after call to c_common_nodes_and_builtins for type nodes to be good. */ cpp_opts->precision = TYPE_PRECISION (intmax_type_node); cpp_opts->char_precision = TYPE_PRECISION (char_type_node); cpp_opts->int_precision = TYPE_PRECISION (integer_type_node); cpp_opts->wchar_precision = TYPE_PRECISION (wchar_type_node); cpp_opts->unsigned_wchar = TYPE_UNSIGNED (wchar_type_node); cpp_opts->bytes_big_endian = BYTES_BIG_ENDIAN; /* This can't happen until after wchar_precision and bytes_big_endian are known. */ cpp_init_iconv (parse_in);
next prev parent reply other threads:[~2012-11-05 15:32 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-11-05 2:22 [Bug fortran/55210] New: cannot #define FOO 'a' shobbo at gmail dot com 2012-11-05 15:32 ` burnus at gcc dot gnu.org [this message] 2021-08-27 1:46 ` [Bug fortran/55210] cannot use macro #define FOO 'a' in a conditional pinskia at gcc dot gnu.org 2021-08-27 1:50 ` pinskia at gcc dot gnu.org 2021-08-27 1:54 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-55210-4-u3jgpTNjeP@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).