[fortran] ICE in fold_convert, at fold-const.c:2028

2005-10-21 Thread Bernhard Fischer
Hi,

Before i try to reduce the module in which i'm seeing this, does the
backtrace sound familiar to someone?

TIA,

$ gfortran-4.1-HEAD -v -ffree-form -ffixed-line-length-none -W -Wall
-Wextra -pedantic  -O0 -march=pentium4 -mtune=pentium4 -I./include -c
core_rel.f90
Using built-in specs.
Target: i686-linux-gnu
Configured with: ../../src/gcc/configure -v
--enable-languages=c,c++,f95,treelang --prefix=/opt/gcc-4.1/
--enable-shared --with-system-zlib --libexecdir=/opt/gcc-4.1//lib
--enable-nls --without-included-gettext --enable-threads=posix
--program-suffix=-4.1-HEAD --enable-__cxa_atexit
--enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-mpfr
--disable-werror --enable-debug --enable-libstdcxx-debug
--enable-checking=release i686-linux-gnu
Thread model: posix
gcc version 4.1.0 20051020 (experimental)
 /opt/gcc-4.1/bin/../lib/gcc/i686-linux-gnu/4.1.0/f951 core_rel.f90
-quiet -dumpbase core_rel.f90 -march=pentium4 -mtune=pentium4 -auxbase
core_rel -O0 -W -Wall -Wextra -pedantic -version -ffree-form
-ffixed-line-length-none -I./include -o /tmp/cc5Ipqva.s
GNU F95 version 4.1.0 20051020 (experimental) (i686-linux-gnu)
compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu
4.0.1-4ubuntu9).
GGC heuristics: --param ggc-min-expand=99 --param
ggc-min-heapsize=129565
core_rel.f90: In function 'spawn_pp':
core_rel.f90:251: warning: unused variable 'inplin'
core_rel.f90:251: warning: unused variable 'ldum'
core_rel.f90:179: internal compiler error: in fold_convert, at
fold-const.c:2028
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html> for instructions.
[EMAIL PROTECTED]:/scratch/src$ gdb -q
/opt/gcc-4.1/bin/../lib/gcc/i686-linux-gnu/4.1.0/f951
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) b fold-const.c:2027
Breakpoint 1 at 0x817611c: file ../../../src/gcc/gcc/fold-const.c, line
2027.
(gdb) run core_rel.f90 -quiet -dumpbase core_rel.f90 -march=pentium4
-mtune=pentium4 -auxbase core_rel -O0 -W -Wall -Wextra -pedantic
-version -ffree-form -ffixed-line-length-none -I./include -o
/tmp/cc4tkN0e.s
Starting program: /opt/gcc-4.1/lib/gcc/i686-linux-gnu/4.1.0/f951
core_rel.f90 -quiet -dumpbase core_rel.f90 -march=pentium4
-mtune=pentium4 -auxbase core_rel -O0 -W -Wall -Wextra -pedantic
-version -ffree-form -ffixed-line-length-none -I./include -o
/tmp/cc4tkN0e.s
GNU F95 version 4.1.0 20051020 (experimental) (i686-linux-gnu)
compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu
4.0.1-4ubuntu9).
GGC heuristics: --param ggc-min-expand=99 --param
ggc-min-heapsize=129565
core_rel.f90: In function 'spawn_pp':
core_rel.f90:251: warning: unused variable 'inplin'
core_rel.f90:251: warning: unused variable 'ldum'

Breakpoint 1, fold_convert (type=0xb7d9fb24, arg=0xb7dcc8f0) at
../../../src/gcc/gcc/fold-const.c:2028
2028  gcc_unreachable ();
(gdb) bt
#0  fold_convert (type=0xb7d9fb24, arg=0xb7dcc8f0) at
../../../src/gcc/gcc/fold-const.c:2028
#1  0x080a2963 in gfc_trans_scalar_assign (lse=0xbfbbbd94,
rse=0xbfbbbd6c, type=BT_DERIVED)
at ../../../src/gcc/gcc/fortran/trans-expr.c:2574
#2  0x080a5f82 in gfc_trans_assignment (expr1=0x85a8a40,
expr2=0x85d40b8)
at ../../../src/gcc/gcc/fortran/trans-expr.c:2740
#3  0x080a6219 in gfc_trans_assign (code=0xb7db82e0) at
../../../src/gcc/gcc/fortran/trans-expr.c:2792
#4  0x0809508a in gfc_trans_code (code=0x85da758) at
../../../src/gcc/gcc/fortran/trans.c:493
#5  0x080af42e in gfc_trans_do (code=0x861d690) at
../../../src/gcc/gcc/fortran/trans-stmt.c:582
#6  0x08094f3a in gfc_trans_code (code=0x861d690) at
../../../src/gcc/gcc/fortran/trans.c:549
#7  0x080aed4a in gfc_trans_if_1 (code=0x85edf80) at
../../../src/gcc/gcc/fortran/trans-stmt.c:424
#8  0x08094f1d in gfc_trans_code (code=0x85ee6e8) at
../../../src/gcc/gcc/fortran/trans.c:541
#9  0x080a147a in gfc_generate_function_code (ns=0x85a64e0) at
../../../src/gcc/gcc/fortran/trans-decl.c:2494
#10 0x08095265 in gfc_generate_module_code (ns=0x85a5478) at
../../../src/gcc/gcc/fortran/trans.c:712
#11 0x0807b9a7 in gfc_parse_file () at
../../../src/gcc/gcc/fortran/parse.c:2641
#12 0x080916ed in gfc_be_parse_file (set_yydebug=0) at
../../../src/gcc/gcc/fortran/f95-lang.c:286
#13 0x082d32c8 in toplev_main (argc=11, argv=0xbfbbc154) at
../../../src/gcc/gcc/toplev.c:990
#14 0xb7e51ea2 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
#15 0x0804ad51 in _start () at ../sysdeps/i386/elf/start.S:119
(gdb) p type->common.code
$1 = RECORD_TYPE
(gdb) c
Continuing.
core_rel.f90:179: internal compiler error: in fold_convert, at
fold-const.c:2028
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html> for instructions.



[patch] pr 21302 Max line length in free form mode

2005-08-08 Thread Bernhard Fischer
Hi,

Attached proposed patch would close pr 21302 for me.

Is reusing -ffixed-line-length instead of introducing a new
-fline-length ok?
If it isn't, should -ffixed-line-length be renamed to -fline-length
and -ffixed-line-length be an alias for the new -fline-length?

thank you,
Bernhard
Index: gcc/fortran/scanner.c
===
RCS file: /cvsroot/gcc/gcc/gcc/fortran/scanner.c,v
retrieving revision 1.22
diff -u -r1.22 scanner.c
--- gcc/fortran/scanner.c   14 Jul 2005 07:14:37 -  1.22
+++ gcc/fortran/scanner.c   4 Aug 2005 17:58:42 -
@@ -680,7 +680,7 @@
In fixed mode, we expand a tab that occurs within the statement
label region to expand to spaces that leave the next character in
the source region.
-   load_line returns wether the line was truncated.  */
+   load_line returns whether the line was truncated.  */
 
 static int
 load_line (FILE * input, char **pbuf, int *pbuflen)
@@ -690,9 +690,12 @@
   char *buffer;
 
   /* Determine the maximum allowed line length.  */
-  if (gfc_current_form == FORM_FREE)
-maxlen = GFC_MAX_LINE;
-  else
+  if (gfc_current_form == FORM_FREE) {
+ if (gfc_option.fixed_line_length == 72) /* default */
+   maxlen = GFC_MAX_LINE;
+ else
+   maxlen = gfc_option.fixed_line_length;
+  } else
 maxlen = gfc_option.fixed_line_length;
 
   if (*pbuf == NULL)



Re: [patch] pr 21302 Max line length in free form mode

2005-08-10 Thread Bernhard Fischer
On Mon, Aug 08, 2005 at 02:14:42PM -0700, Steve Kargl wrote:
>On Mon, Aug 08, 2005 at 09:23:07AM +0200, Bernhard Fischer wrote:

>> +  if (gfc_option.fixed_line_length == 72) /* default */
>> +maxlen = GFC_MAX_LINE;

>Unless I misunderstand the above, the following
>
>   gfortran -ffixed_line_length=72 test.f90
>
>will use GFC_MAX_LINE, which is 132 (not the requested
>length of 72).

right. Corrected patch attached.
gcc-line-length.diff:

PR 21302
* gcc/fortran/options.c: initialize fixed_line_length to -1.
* gcc/fortran/scanner.c (load_line): default fixed_line_length
to GFC_MAX_LINE for FORM_FREE else default to 72. If a line
length was given, use it.

Perhaps also check that the line-length given is not too big?
Something like
gcc-line-length-max.diff:

* gcc/fortran/options.c: make sure  that -ffixed-line-length
is less than 1048577.

ok?
-- 
Bernhard
Index: gcc/fortran/options.c
===
RCS file: /cvsroot/gcc/gcc/gcc/fortran/options.c,v
retrieving revision 1.22
diff -u -p -r1.22 options.c
--- gcc/fortran/options.c   25 Jun 2005 00:40:35 -  1.22
+++ gcc/fortran/options.c   10 Aug 2005 13:20:22 -
@@ -45,7 +45,7 @@ gfc_init_options (unsigned int argc ATTR
   gfc_option.source = NULL;
   gfc_option.module_dir = NULL;
   gfc_option.source_form = FORM_UNKNOWN;
-  gfc_option.fixed_line_length = 72;
+  gfc_option.fixed_line_length = -1;
   gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
   gfc_option.verbose = 0;
 
Index: gcc/fortran/scanner.c
===
RCS file: /cvsroot/gcc/gcc/gcc/fortran/scanner.c,v
retrieving revision 1.23
diff -u -p -r1.23 scanner.c
--- gcc/fortran/scanner.c   9 Aug 2005 08:08:28 -   1.23
+++ gcc/fortran/scanner.c   10 Aug 2005 13:20:22 -
@@ -690,8 +690,11 @@ load_line (FILE * input, char **pbuf, in
   char *buffer;
 
   /* Determine the maximum allowed line length.  */
-  if (gfc_current_form == FORM_FREE)
-maxlen = GFC_MAX_LINE;
+  if (gfc_option.fixed_line_length == -1)
+if (gfc_current_form == FORM_FREE)
+  maxlen = GFC_MAX_LINE;
+else
+  maxlen = 72; /* GFC_DEFAULT_LINE */
   else
 maxlen = gfc_option.fixed_line_length;
 
Index: gcc/fortran/options.c
===
RCS file: /cvsroot/gcc/gcc/gcc/fortran/options.c,v
retrieving revision 1.22
diff -u -p -r1.22 options.c
--- gcc/fortran/options.c   25 Jun 2005 00:40:35 -  1.22
+++ gcc/fortran/options.c   10 Aug 2005 14:51:53 -
@@ -289,6 +289,9 @@ gfc_handle_option (size_t scode, const c
 case OPT_ffixed_line_length_:
   if (value != 0 && value < 7)
gfc_fatal_error ("Fixed line length must be at least seven.");
+  else
+   if (value > 1048576)
+ gfc_fatal_error ("Fixed line length must be at most 1048576.");
   gfc_option.fixed_line_length = value;
   break;