This feels like subscript out of bounds.  Please add standard gfortran
debugging options before asking for deeper analysis.  In particular,
`-fcheck=all` will check for most subscripts out of bounds, including
string indexing.  It will then give intelligent legible diagnostics.

     `gfortran -g -O0 -fbacktrace -fcheck=all -Wall`


On Fri, Aug 1, 2025 at 2:59 PM Kenneth Wolcott <[email protected]>
wrote:

> Hi;
>
> Weird error from a very short bash script involving gfortran and flang
> compile/execution...
>
> I'm trying to compile and execute a Rosetta Code task written in Fortran:
>
> https://rosettacode.org/wiki/Non-decimal_radices/Convert#Fortran
>
> *****************************
> Here is my ./test_it.bash script:
>
> cat -n ./test_it.bash
>      1 #!/bin/bash
>      2
>      3 printf "\nUsing gfortran-mp-14 ...\n"
>      4 gfortran-mp-14 -x none -o ./non_decimal_radices_convert
> ./non_decimal_radices_convert.f90
>      5 if [ -f ./non_decimal_radices_convert ]; then
>      6 ./non_decimal_radices_convert
>      7 rm ./non_decimal_radices_convert
>      8 fi
>      9
>     10 printf "\nUsing flang-mp-20...\n"
>     11 /opt/local/bin/flang-mp-20 -o ./non_decimal_radices_convert
> ./non_decimal_radices_convert.f90
>     12 if [ -f ./non_decimal_radices_convert ]; then
>     13 ./non_decimal_radices_convert
>     14 rm ./non_decimal_radices_convert
>     15 fi
>
> *****************************
> *****************************
> Here are the results:
>
> ./test_it.bash
>
> Using gfortran-mp-14 ...
>           26
>
> Program received signal SIGBUS: Access to an undefined portion of a
> memory object.
>
> Backtrace for this error:
> #0  0x102e520a7
> #1  0x102e51357
> #2  0x1850b56a3
> #3  0x102c7c997
> #4  0x102c7c997
> #5  0x102c7c9ef
> ./test_it.bash: line 8: 93614 Bus error: 10
> ./non_decimal_radices_convert
>
> Using flang-mp-20...
>  26
>  1a
> *****************************
>
> Was the executable generated by gfortran still executing when I deleted it?
>
> Why is there a difference?
>
> Is there a bug here?
>
> Thanks,
> Ken Wolcott
>

Reply via email to