public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/9837] New: sizeof( int(*)(int *) ) == 1?
@ 2009-02-11 20:18 chris dot interim at gmail dot com
2009-02-11 20:37 ` [Bug gdb/9837] " drow at false dot org
2009-02-11 22:17 ` chris dot interim at gmail dot com
0 siblings, 2 replies; 5+ messages in thread
From: chris dot interim at gmail dot com @ 2009-02-11 20:18 UTC (permalink / raw)
To: gdb-prs
Walk up to a machine with gdb.
Run gdb.
Type "print sizeof( int(*)(int *) )"
The result comes back as "1".
I believe on most machines the answer should be 4. Maybe 8 on some.
You might even have one that comes back with 2 if you're into antiques.
But 1?
All of the components of this (function pointer, int, int pointer) have a
size greater than 1.
--
Summary: sizeof( int(*)(int *) ) == 1?
Product: gdb
Version: 6.8
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
AssignedTo: unassigned at sourceware dot org
ReportedBy: chris dot interim at gmail dot com
CC: gdb-prs at sourceware dot org
GCC build triplet: i386-redhat-linux
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
http://sourceware.org/bugzilla/show_bug.cgi?id=9837
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/9837] sizeof( int(*)(int *) ) == 1?
2009-02-11 20:18 [Bug gdb/9837] New: sizeof( int(*)(int *) ) == 1? chris dot interim at gmail dot com
@ 2009-02-11 20:37 ` drow at false dot org
2009-02-11 22:17 ` chris dot interim at gmail dot com
1 sibling, 0 replies; 5+ messages in thread
From: drow at false dot org @ 2009-02-11 20:37 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From drow at false dot org 2009-02-11 20:37 -------
Subject: Re: New: sizeof( int(*)(int *) ) == 1?
On Wed, Feb 11, 2009 at 08:18:35PM -0000, chris dot interim at gmail dot com wrote:
> Walk up to a machine with gdb.
> Run gdb.
> Type "print sizeof( int(*)(int *) )"
>
> The result comes back as "1".
Try this to see the underlying problem:
(gdb) ptype int(*)(int *)
type = int ()
I can't find it now, but there should be another bug open about the
problems with function pointer types.
--
http://sourceware.org/bugzilla/show_bug.cgi?id=9837
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/9837] sizeof( int(*)(int *) ) == 1?
2009-02-11 20:18 [Bug gdb/9837] New: sizeof( int(*)(int *) ) == 1? chris dot interim at gmail dot com
2009-02-11 20:37 ` [Bug gdb/9837] " drow at false dot org
@ 2009-02-11 22:17 ` chris dot interim at gmail dot com
1 sibling, 0 replies; 5+ messages in thread
From: chris dot interim at gmail dot com @ 2009-02-11 22:17 UTC (permalink / raw)
To: gdb-prs
------- Additional Comments From chris dot interim at gmail dot com 2009-02-11 22:17 -------
For completeness:
gdb
GNU gdb Fedora (6.8-23.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
(gdb) print sizeof( int(*)(int *) )
$1 = 1
(gdb) ptype int(*)(int *)
type = int ()
(gdb) print sizeof( int () )
$2 = 1
(gdb) print sizeof( int )
$3 = 4
(gdb) print sizeof( int * )
$4 = 4
(gdb) quit
--
http://sourceware.org/bugzilla/show_bug.cgi?id=9837
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/9837] sizeof( int(*)(int *) ) == 1?
[not found] <bug-9837-4717@http.sourceware.org/bugzilla/>
2012-12-31 4:53 ` muhammad_bilal at mentor dot com
@ 2012-12-31 4:58 ` muhammad_bilal at mentor dot com
1 sibling, 0 replies; 5+ messages in thread
From: muhammad_bilal at mentor dot com @ 2012-12-31 4:58 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=9837
bilal <muhammad_bilal at mentor dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
--- Comment #4 from bilal <muhammad_bilal at mentor dot com> 2012-12-31 04:58:26 UTC ---
Hi All
i think that, This is not a bug its only a gcc grammatical rule
Thanks
Bilal
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/9837] sizeof( int(*)(int *) ) == 1?
[not found] <bug-9837-4717@http.sourceware.org/bugzilla/>
@ 2012-12-31 4:53 ` muhammad_bilal at mentor dot com
2012-12-31 4:58 ` muhammad_bilal at mentor dot com
1 sibling, 0 replies; 5+ messages in thread
From: muhammad_bilal at mentor dot com @ 2012-12-31 4:53 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=9837
bilal <muhammad_bilal at mentor dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |muhammad_bilal at mentor
| |dot com
--- Comment #3 from bilal <muhammad_bilal at mentor dot com> 2012-12-31 04:53:50 UTC ---
Hi ALL
The sizeof operator return 1 when it operates on function name like
e.g
sizeof(int())=1
sizeof(float())=1
sizeof(main)=1
sizeof(printf)=1
etc
Its the gcc grammatical rule
the problem discuss here
http://stackoverflow.com/questions/3838866/what-is-the-sizeofmain-sizeofprintf-sizeofscanf
Regards,
Bilal
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-12-31 4:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-11 20:18 [Bug gdb/9837] New: sizeof( int(*)(int *) ) == 1? chris dot interim at gmail dot com
2009-02-11 20:37 ` [Bug gdb/9837] " drow at false dot org
2009-02-11 22:17 ` chris dot interim at gmail dot com
[not found] <bug-9837-4717@http.sourceware.org/bugzilla/>
2012-12-31 4:53 ` muhammad_bilal at mentor dot com
2012-12-31 4:58 ` muhammad_bilal at mentor dot com
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 read-only IMAP folder(s) and NNTP newsgroup(s).