public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/55210] New: cannot #define FOO 'a' @ 2012-11-05 2:22 shobbo at gmail dot com 2012-11-05 15:32 ` [Bug fortran/55210] cannot use macro #define FOO 'a' in a conditional burnus at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: shobbo at gmail dot com @ 2012-11-05 2:22 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55210 Bug #: 55210 Summary: cannot #define FOO 'a' Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: shobbo@gmail.com If I define a macro as in the summary I get the following output: [*] gfortran -cpp testfort.f -o testfort <built-in>:0:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions. I tried it with -cpp, -xf95-cpp-input and -xf77-cpp-input. using gfortran 4.7.2, 4.4.3 and 4.4.4. !---- testfort.f #define FOO 'a' program testfort implicit none print *, 'pretest' #if FOO == 'a' print *, "the macro is a character a" #endif print *, 'epitest' end program ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/55210] cannot use macro #define FOO 'a' in a conditional 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 2021-08-27 1:46 ` pinskia at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: burnus at gcc dot gnu.org @ 2012-11-05 15:32 UTC (permalink / raw) To: gcc-bugs 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); ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/55210] cannot use macro #define FOO 'a' in a conditional 2012-11-05 2:22 [Bug fortran/55210] New: cannot #define FOO 'a' shobbo at gmail dot com 2012-11-05 15:32 ` [Bug fortran/55210] cannot use macro #define FOO 'a' in a conditional burnus at gcc dot gnu.org @ 2021-08-27 1:46 ` 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 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-08-27 1:46 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55210 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |siteg at mathalacarte dot com --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- *** Bug 65025 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/55210] cannot use macro #define FOO 'a' in a conditional 2012-11-05 2:22 [Bug fortran/55210] New: cannot #define FOO 'a' shobbo at gmail dot com 2012-11-05 15:32 ` [Bug fortran/55210] cannot use macro #define FOO 'a' in a conditional burnus at gcc dot gnu.org 2021-08-27 1:46 ` 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 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-08-27 1:50 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55210 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- *** Bug 68968 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/55210] cannot use macro #define FOO 'a' in a conditional 2012-11-05 2:22 [Bug fortran/55210] New: cannot #define FOO 'a' shobbo at gmail dot com ` (2 preceding siblings ...) 2021-08-27 1:50 ` pinskia at gcc dot gnu.org @ 2021-08-27 1:54 ` pinskia at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-08-27 1:54 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55210 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Melven.Roehrig-Zoellner@DLR | |.de --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- *** Bug 91237 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-27 1:54 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-11-05 2:22 [Bug fortran/55210] New: cannot #define FOO 'a' shobbo at gmail dot com 2012-11-05 15:32 ` [Bug fortran/55210] cannot use macro #define FOO 'a' in a conditional burnus at gcc dot gnu.org 2021-08-27 1:46 ` 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
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).