linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Steve Graegert" <graegerts@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: Re: Curious segmentation fault - please help
Date: Sat, 13 May 2006 23:04:33 +0200	[thread overview]
Message-ID: <6a00c8d50605131404sc845ab7p5604a5e902c5ff55@mail.gmail.com> (raw)
In-Reply-To: <200605140028.17718.samjnaa@gmail.com>

On 5/13/06, Shriramana Sharma <samjnaa@gmail.com> wrote:
> Saturday 13 May 2006 22:50 samaye, Steve Graegert alekhiit:
>
> > > vaasara[6] does give the correct output. The fault is seen *after*
> > > vaasara[6] is read and written to stdout:
> >
> > which accesses the last element correctly.  Nevertheless, the function
> > tries to read one more character causing a segfault.  Please don't
> > misinterpret valgind's output: we are still in listsplpanchaanga().
>
> Of course. But all I am doing is using the standard fprintf function. Is it
> possible that the behaviour of this function would have changed from glibc
> 2.36 to glibc 2.4?

OK, now I got the code.  You're right, it's not as simple as it seemed
at first glance.  Just oversaw some lines of the valgrind output,
showing that accessing element 0 (zero) is indeed failing all the
time.  Sorry, just did not get it at first.

Let's try another thing before filing a bug or something: instruct
valgrind to attach to a debugger when the error occurs:

% valgrind --tool=memcheck --db-attach=yes -v ./monthpan

when entered the debugger call

(gdb) where
... /* stack trace */
(gdb) whatis grahanaama
... /* prints type and size of expression */
(gdb) print grahanaama[0]
... /* should display contents of expression; may result in an error*/

Try to capture the output and mail it to me privately.  You can also
send me the complete program and I'll have a look at it.

If all goes well here, you may have uncovered some weird behaviour
which may indeed be a bug either in glibc or gcc.

> > Hm, don't know what could have changed.  I am not a SuSEr anymore;
> > returned to Debian and NetBSD.
>
> So can't see you anymore on SLE?

Yes, I simply don't have the time to follow SLE discussions anymore.

	\Steve

      reply	other threads:[~2006-05-13 21:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-13 14:28 Curious segmentation fault - please help Shriramana Sharma
2006-05-13 15:09 ` Steve Graegert
2006-05-13 16:27   ` Shriramana Sharma
2006-05-13 17:20     ` Steve Graegert
2006-05-13 18:58       ` Shriramana Sharma
2006-05-13 21:04         ` Steve Graegert [this message]

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=6a00c8d50605131404sc845ab7p5604a5e902c5ff55@mail.gmail.com \
    --to=graegerts@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).