Re: Program terminated with SIGSEGV when trying to print an array element

Daniel Jacobowitz
2005-06-07T13:14:25Z

On Tue, Jun 07, 2005 at 04:58:10PM +0800, Wu Zhou wrote:
> As far as I can see, the problem lies in that GDB take TYPE_CODE_PTR as
> a function call as well. But in the above failing testcase, "a" is a
> pointer to array type (Fortran treat formal parameter as pointer). Its
> code is TYPE_CODE_PTR indeed, but it is not a function call.
>
> So maybe we need to change the code logic above. My thought is when the
> code match TYPE_CODE_PTR, we first get its target_type. If it is
> TYPE_CODE_ARRAY, we can goto multi_f77_subscript. If not, we can go on
> with the orignial path. But I have one question on the original code:
> in which circumstance should a function's code return TYPE_CODE_PTR,
> isn't the code of a function always return TYPE_CODE_FUNC?
>
> Any thought on this? Any suggestions and comments are highly appreciated!

You didn't mention what Fortran compiler was being used. Probably,
whichever one it was, it generates debug information that GDB is not
expecting.

It sounds like you're right; we should be checking the target type of
the pointer. Can we end up with a pointer to a string, too?

I'm afraid I don't know the answer to your other question.

--
Daniel Jacobowitz
CodeSourcery, LLC