From: David Lecomber <david@streamline-computing.com>
To: gdb-patches@sources.redhat.com
Subject: Fortran: Intel vs G77
Date: Wed, 15 Jan 2003 21:51:00 -0000 [thread overview]
Message-ID: <20030115215104.A17981@streamline-computing.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 838 bytes --]
The current situation with g77 and Intel meets gdb is as follows for
multi-dim arrays
Intel compiled code:
whatis -- wrong way round real(4 * 5 ) is reported as real (5 * 4)
indexing -- correct
print elements -- boundaries not aligned properly ( it prints a 5 * 4
as a 4 * 5 )
g77 fortran compilers compiled code:
whatis -- correct
print elements -- correct
indexing -- 'print A(1,2)' will get the wrong answer.
So, unless there is a method to check what the compiler was used, we are
left with
1. status quo
or
2. compile up two different versions -- one for gdb + intel, the
other for gdb + g77
Does anyone know of the existence of such a check?
Patches to fix the three issues are attached, but of course they
cannot all be applied at once; the fix to make g77 work will bust
intel, and vice-versa..
David
[-- Attachment #2: gdb.g77-array-printing-patch --]
[-- Type: text/plain, Size: 621 bytes --]
*** eval.c Fri Jan 4 17:51:38 2002
--- eval.c Wed Oct 16 14:08:04 2002
*************** evaluate_subexp_standard (struct type *e
*** 1358,1364 ****
if (retcode == BOUND_FETCH_ERROR)
error ("Cannot obtain dynamic lower bound");
! array_size_array[i] = upper - lower + 1;
/* Zero-normalize subscripts so that offsetting will work. */
--- 1358,1364 ----
if (retcode == BOUND_FETCH_ERROR)
error ("Cannot obtain dynamic lower bound");
! array_size_array[nargs - i + 1] = upper - lower + 1;
/* Zero-normalize subscripts so that offsetting will work. */
[-- Attachment #3: gdb.intel-print-elements-patch --]
[-- Type: text/plain, Size: 1665 bytes --]
*** f-valprint.c Mon Oct 21 17:47:36 2002
--- /tmp/gdb-5.2/gdb/f-valprint.c Mon Oct 21 16:14:33 2002
*************** f77_create_arrayprint_offset_tbl (struct
*** 234,239 ****
--- 234,241 ----
int eltlen;
int ndimen = 1;
int upper, lower, retcode;
+ int i, j;
+ int t;
tmp_type = type;
*************** f77_create_arrayprint_offset_tbl (struct
*** 256,270 ****
ndimen++;
}
/* Now we multiply eltlen by all the offsets, so that later we
can print out array elements correctly. Up till now we
know an offset to apply to get the item but we also
have to know how much to add to get to the next item */
ndimen--;
eltlen = TYPE_LENGTH (tmp_type);
F77_DIM_OFFSET (ndimen) = eltlen;
! while (--ndimen > 0)
{
eltlen *= F77_DIM_SIZE (ndimen + 1);
F77_DIM_OFFSET (ndimen) = eltlen;
--- 258,285 ----
ndimen++;
}
+
/* Now we multiply eltlen by all the offsets, so that later we
can print out array elements correctly. Up till now we
know an offset to apply to get the item but we also
have to know how much to add to get to the next item */
ndimen--;
+
+ /**
+ intel compiler, reckon this to be wrong way round.. so here's a quick in-place swap.
+ */
+
+ for (i = 1, j = ndimen; i < j; i++,j--) {
+ t = F77_DIM_SIZE(i);
+ F77_DIM_SIZE(i) = F77_DIM_SIZE(j);
+ F77_DIM_SIZE(j) = t;
+ }
+
eltlen = TYPE_LENGTH (tmp_type);
F77_DIM_OFFSET (ndimen) = eltlen;
!
! while (--ndimen > 0)
{
eltlen *= F77_DIM_SIZE (ndimen + 1);
F77_DIM_OFFSET (ndimen) = eltlen;
[-- Attachment #4: gdb.intel-print-whatis-patch --]
[-- Type: text/plain, Size: 1526 bytes --]
*** f-typeprint.c Sun Jan 20 19:42:04 2002
--- f-typeprint.c Mon Oct 21 16:18:12 2002
*************** f_type_print_varspec_suffix (struct type
*** 175,183 ****
if (arrayprint_recurse_level == 1)
fprintf_filtered (stream, "(");
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
retcode = f77_get_dynamic_lowerbound (type, &lower_bound);
--- 175,183 ----
if (arrayprint_recurse_level == 1)
fprintf_filtered (stream, "(");
+ else
+ fprintf_filtered (stream, ",");
retcode = f77_get_dynamic_lowerbound (type, &lower_bound);
*************** f_type_print_varspec_suffix (struct type
*** 212,221 ****
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
if (arrayprint_recurse_level == 1)
fprintf_filtered (stream, ")");
- else
- fprintf_filtered (stream, ",");
arrayprint_recurse_level--;
break;
--- 212,223 ----
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
+
+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
+ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
+
if (arrayprint_recurse_level == 1)
fprintf_filtered (stream, ")");
arrayprint_recurse_level--;
break;
next reply other threads:[~2003-01-15 21:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-15 21:51 David Lecomber [this message]
2003-01-15 22:09 ` Daniel Jacobowitz
2003-01-15 23:22 ` David Lecomber
2003-01-16 4:41 ` Daniel Jacobowitz
2003-01-16 10:40 ` David Lecomber
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=20030115215104.A17981@streamline-computing.com \
--to=david@streamline-computing.com \
--cc=gdb-patches@sources.redhat.com \
/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: link
Be 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