Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > seg fault

Reply
Thread Tools

seg fault

 
 
Bill Cunningham
Guest
Posts: n/a
 
      06-19-2008


> Johannes Bauer <> writes:


>> Dump of assembler code from 0x2b25ed8bdc77 to 0x2b25ed8bdcb8:
>> 0x00002b25ed8bdc77: lds (%rdi),%ecx
>> 0x00002b25ed8bdc79: mov $0x5d,%dh
>> 0x00002b25ed8bdc7b: add %cl,0xf(%rax)
>> 0x00002b25ed8bdc7e: mov $0x4244f6c3,%esi
>> 0x00002b25ed8bdc83: add %esp,(%rax)
>> 0x00002b25ed8bdc85: jne 0x2b25ed8bdc75
>> 0x00002b25ed8bdc87: cmp $0x2d,%bl
>> 0x00002b25ed8bdc8a: je 0x2b25ed8be0d1
>> 0x00002b25ed8bdc90: cmp $0x2b,%bl
>> 0x00002b25ed8bdc93: movl $0x0,0x78(%rsp)
>> 0x00002b25ed8bdc9b: je 0x2b25ed8be32b
>> 0x00002b25ed8bdca1: movzbl (%r14),%esi
>> 0x00002b25ed8bdca5: xor %edx,%edx
>> 0x00002b25ed8bdca7: test %sil,%sil
>> 0x00002b25ed8bdcaa: je 0x2b25ed8bdcd5
>> 0x00002b25ed8bdcac: cmp 0x0(%rbp),%sil
>> 0x00002b25ed8bdcb0: mov $0x1,%ecx
>> 0x00002b25ed8bdcb5: je 0x2b25ed8bdcc9
>> 0x00002b25ed8bdcb7: jmp 0x2b25ed8bdcdd
>> End of assembler dump.
>>
>> Now I would sure be surprised if that would have helped you.
>>
>> Regards,
>> Johannes


Just a bunch of jumping comparing values of segment registers. Extended
stack pointer so on. Looks like garbage or should I say assembly code.

Bill


 
Reply With Quote
 
 
 
 
jacob navia
Guest
Posts: n/a
 
      06-19-2008
Bill Cunningham wrote:
> "Joachim Schmitz" <> wrote in message
> news:g3boc5$1bn$...
>
>>> gcc-3.4.6

>> And you are aware that gcc (no matter what version) is not a fully
>> conforming C99 compiler?
>> Not even with --std=c99.

>
> No I didn't know that. I guess you learn something new everyday.
>
> Bill
>


The problems with gcc's implementation are completely MINIMAL.

What you also do not know is that the "regulars" in this group have been
waging a campaign against standard C because they would like to
return to C89 or maybe even further back.

When anyone speaks about standard C they will point out that
there are no implementations (what is obviously a lie) or
other half truths. "Joachim Schmmitz" is a good example.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
 
Reply With Quote
 
 
 
 
Nick Keighley
Guest
Posts: n/a
 
      06-19-2008
On 18 Jun, 14:15, Richard<rgr...@gmail.com> wrote:
> santosh <santosh....@gmail.com> writes:
> > Richard Heathfield wrote:

>
> >> santosh said:

>
> >>> Richard Heathfield wrote:

>
> >>>> santosh said:

>
> >>>>> Bill Cunningham wrote:

>
> >>>>> [ ... ]

>
> >>>>>> I use fprintfs to stderr so there's an error only if there's an
> >>>>>> error.

>
> >>>>> How do you come to this conclusion?

>
> >>>> What are you suggesting, santosh - that there might be an error even
> >>>> if there isn't an error?

>
> >>> I was asking Bill why "there's an error only if there's an error"
> >>> only when he is using fprintf.

>
> >>> One or more errors could have occurred before the fprintf call,
> >>> perhaps after it, perhaps in the call itself. Fprintf doesn't
> >>> guarantee that you will spot all your errors.

>
> >> I've never heard of Fprintf - but you can't begin a sentence with a
> >> lower case letter! Ain't the English/C boundary wonderful?

>
> >> Seriously, you are obviously right - it's our job to spot bugs, and
> >> fprintf is at best a tool that can help us to do that (just as a
> >> debugger is only a tool). Tools are useful, but only fools rely on
> >> them to do things they are not designed to do. We can *use* tools to
> >> do things they are not designed to do, but if we are wise we will
> >> recognise that they may not achieve the goal we intend.

>
> >> In this case, the best approach is probably to use a debugger to find
> >> out where the seg fault is occurring, and then apply one's brain to
> >> find the cause. Debuggers /can/ help with this, especially good ones
> >> that let you explore the state of the call stack (e.g. the Visual C++
> >> debugger, or gdb), but they are no magic wand, and no substitute for a
> >> clear head and a knowledge of the language.

>
> > I completely concur except to say that in this particular case a
> > debugger was not necessary because multiple cases of undefined
> > behaviour simply _stood_ _out_ at a first glance at the code.

>
> Would people stop stating this? OF COURSE some errors "simply stand
> out". But *even* in those cases it does no harm to use one. Sheesh.- Hide quoted text -


ok this is boring. I suspect people are ignoring your THE DEBUGGEr IS
KING stuff
because we've heard it before. But this is once (n?) too many.

- debuggers are useful
- for the record, I sometimes use a debugger
- not everyone finds single stepping throgh code useful
- there are other ways of debugging code

and in this case I can quite understand it is possible to debug the
program
in question without a debugger. Though Bill probably needs one. The
Undefined
Behaviour probaly dosn't leap out at him.


--
Nick Keighley




 
Reply With Quote
 
Nick Keighley
Guest
Posts: n/a
 
      06-19-2008
On 19 Jun, 08:09, jacob navia <ja...@nospam.com> wrote:
> Bill Cunningham wrote:
> > "Joachim Schmitz" <nospam.j...@schmitz-digital.de> wrote in message
> >news:g3boc5$1bn$...


> >>> gcc-3.4.6
> >> And you are aware that gcc (no matter what version) is not a fully
> >> conforming C99 compiler?
> >> Not even with --std=c99.

>
> > * * No I didn't know that. I guess you learn something new everyday..


you don't appear to


> The problems with gcc's implementation are completely MINIMAL.


so you agree, gcc isn't a full C99 implementation?


> What you also do not know is that the "regulars" in this group have been
> waging a campaign against standard C because they would like to
> return to C89 or maybe even further back.


do you have any evidence for this extraordinary statement?


> When anyone speaks about standard C they will point out that
> there are no implementations (what is obviously a lie) or
> other half truths. "Joachim Schmmitz" is a good example.


"obviously a lie". I think yours is the obvious lie. Who said
there are no C99 implementations? I think there are about 2. Maybe 3.
win-lcc and gcc are not amongst them.


--
Nick Keighley



 
Reply With Quote
 
Joachim Schmitz
Guest
Posts: n/a
 
      06-19-2008
jacob navia wrote:
> Bill Cunningham wrote:
>> "Joachim Schmitz" <> wrote in message
>> news:g3boc5$1bn$...
>>
>>>> gcc-3.4.6
>>> And you are aware that gcc (no matter what version) is not a fully
>>> conforming C99 compiler?
>>> Not even with --std=c99.

>>
>> No I didn't know that. I guess you learn something new everyday.
>>
>> Bill
>>

>
> The problems with gcc's implementation are completely MINIMAL.

The list of problems is several pages long, I wouldn't call that minimal.

> What you also do not know is that the "regulars" in this group have
> been waging a campaign against standard C because they would like to
> return to C89 or maybe even further back.

Nonsense!

> When anyone speaks about standard C they will point out that
> there are no implementations (what is obviously a lie) or
> other half truths. "Joachim Schmmitz" is a good example.

So you're calling me a liar? And misspelling my name?

I know that there are a few fully conforming C99 compiler and have never
claimed otherwise.
The vast majority of compilers though (in numbers of implementations as well
as in number of installations), does not. gcc, M$ Visual C, not even
win-lcc, as reported here in CLC several times.
gcc and Visual C don't even claim to be C99 conforming.

Bye, Jojo


 
Reply With Quote
 
Joachim Schmitz
Guest
Posts: n/a
 
      06-20-2008
CBFalconer wrote:
> Joachim Schmitz wrote:
>>

> ... snip ...
>>
>> I know that there are a few fully conforming C99 compiler and have
>> never claimed otherwise. The vast majority of compilers though
>> (in numbers of implementations as well as in number of
>> installations), does not. gcc, M$ Visual C, not even win-lcc, as
>> reported here in CLC several times. gcc and Visual C don't even
>> claim to be C99 conforming.

>
> Visual-C doesn't make any claim past C90/95.

I haven't said otherwise, have I?

Bye, Jojo


 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      06-20-2008
Richard<> writes:
> Richard Heathfield <> writes:

[...]
>> when people say they
>> rarely use a debugger, he interprets "rarely" as "never".

>
> Nonsense. As usual you twist things and lie.
>

[...]
> I also detect from the responses here that there are many
> programmer who have never used one more out of not being aware of their

^^^^^
> facilities.

[...]

Quoted without further comment.

--
Keith Thompson (The_Other_Keith) kst- <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
seg-fault on vector-auto-reserve Matthias Kaeppler C++ 2 02-27-2005 10:01 PM
seg fault on different linux boxes with C++. goktan C++ 4 08-02-2004 03:25 PM
fstream::open & seg fault Manuel Maria Diaz Gomez C++ 3 07-20-2004 06:18 PM
seg fault because stdexcept.cc not found? Corrine C++ 1 11-27-2003 06:15 AM
Suprising seg fault!!! Vinod C++ 3 09-27-2003 02:43 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57