public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/44316]  New: "initialization from incompatible pointer type" struct initilization error handling
@ 2010-05-28 16:53 herron dot philip at googlemail dot com
  2010-05-28 16:58 ` [Bug c/44316] " tromey at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: herron dot philip at googlemail dot com @ 2010-05-28 16:53 UTC (permalink / raw)
  To: gcc-bugs

This test case demonstrates what i mean:

struct my_struct {
  int x;
  int (*hook_a)( void );
};

int func_a( void )
{
  return 1;
}

void func_b( void )
{
  func_a( );
}

int main( void )
{
  struct my_struct a = { 1, &func_a };
  struct my_struct b = { 2, &func_b };

  return 0;
}

When initializing a struct it would be nice to have an error message detailing
the field which has the incompatible pointer type.


-- 
           Summary: "initialization from incompatible pointer type" struct
                    initilization error handling
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: herron dot philip at googlemail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44316


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/44316] "initialization from incompatible pointer type" struct initilization error handling
  2010-05-28 16:53 [Bug c/44316] New: "initialization from incompatible pointer type" struct initilization error handling herron dot philip at googlemail dot com
@ 2010-05-28 16:58 ` tromey at gcc dot gnu dot org
  2010-05-28 17:12 ` joseph at codesourcery dot com
  2010-05-28 17:15 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at gcc dot gnu dot org @ 2010-05-28 16:58 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 887 bytes --]



------- Comment #1 from tromey at gcc dot gnu dot org  2010-05-28 16:58 -------
Here is what gcc trunk says:

opsy. gcc --syntax-only pr.c
pr.c: In function ‘main’:
pr.c:20:10: warning: initialization from incompatible pointer type [enabled by
default]

The particular case motivating this PR was getting a declaration wrong
and then getting an error from LANG_HOOKS_INITIALIZER.  In this case the
location info is not helpful.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-05-28 16:58:06
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44316


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/44316] "initialization from incompatible pointer type" struct initilization error handling
  2010-05-28 16:53 [Bug c/44316] New: "initialization from incompatible pointer type" struct initilization error handling herron dot philip at googlemail dot com
  2010-05-28 16:58 ` [Bug c/44316] " tromey at gcc dot gnu dot org
@ 2010-05-28 17:12 ` joseph at codesourcery dot com
  2010-05-28 17:15 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: joseph at codesourcery dot com @ 2010-05-28 17:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from joseph at codesourcery dot com  2010-05-28 17:12 -------
Subject: Re:  "initialization from incompatible pointer type"
 struct initilization error handling

You could probably make WARN_FOR_ASSIGNMENT use pedwarn_init.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44316


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/44316] "initialization from incompatible pointer type" struct initilization error handling
  2010-05-28 16:53 [Bug c/44316] New: "initialization from incompatible pointer type" struct initilization error handling herron dot philip at googlemail dot com
  2010-05-28 16:58 ` [Bug c/44316] " tromey at gcc dot gnu dot org
  2010-05-28 17:12 ` joseph at codesourcery dot com
@ 2010-05-28 17:15 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-05-28 17:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2010-05-28 17:15 -------


*** This bug has been marked as a duplicate of 37724 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44316


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-28 17:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-28 16:53 [Bug c/44316] New: "initialization from incompatible pointer type" struct initilization error handling herron dot philip at googlemail dot com
2010-05-28 16:58 ` [Bug c/44316] " tromey at gcc dot gnu dot org
2010-05-28 17:12 ` joseph at codesourcery dot com
2010-05-28 17:15 ` pinskia at gcc dot gnu dot org

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).