public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/16602] New: Spurious warnings about pointer to array -> const pointer to array conversion
@ 2004-07-17  7:50 jozef dot behran at krs dot sk
  2004-07-17  8:49 ` [Bug c/16602] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 16+ messages in thread
From: jozef dot behran at krs dot sk @ 2004-07-17  7:50 UTC (permalink / raw)
  To: gcc-bugs

/* 
  This piece of code will trigger the warning "passing arg 1 of `name' from 
  incompatible pointer type" on lines 24, 25 and 26, but it should not, 
  because the pointers are in fact compatible. To prove the compatibility 
  comment out the "[8]" at line 9 and recompile; the warnings will disappear. 
  The warnings also disappear if the "const" from the OSHSAddrToBinIPv4() 
  declaration is removed; I guess that the "const" is doing problems. 
*/ 
 
typedef int THostAddr[8]; 
 
typedef struct { 
  char Command; 
  THostAddr Host; 
  int Port; 
} TOpenTCPClientCommand; 
 
static void OSHSAddrToBinIPv4(const THostAddr *Host) 
{ 
  THostAddr *MyHost; 
  TOpenTCPClientCommand P; 
  TOpenTCPClientCommand *Packet; 
 
  OSHSAddrToBinIPv4(MyHost); 
  OSHSAddrToBinIPv4(&P.Host); 
  OSHSAddrToBinIPv4(&Packet->Host); 
} 
 
/* 
  - Tested with gcc 3.2.2 on Mandrake GNU/Linux 9.1 ("bamboo") 
    (kernel 2.4.21-0.13mdk) on an i686 
  - Fails also with gcc 3.5.0 (experimental 17072004) on the same machine 
  - There is no bug when pointers to a structure or union are involved. 
*/

-- 
           Summary: Spurious warnings about pointer to array -> const
                    pointer to array conversion
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jozef dot behran at krs dot sk
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 16+ messages in thread
[parent not found: <bug-16602-8968@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-16602-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2014-02-26  2:00 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-17  7:50 [Bug c/16602] New: Spurious warnings about pointer to array -> const pointer to array conversion jozef dot behran at krs dot sk
2004-07-17  8:49 ` [Bug c/16602] " pinskia at gcc dot gnu dot org
     [not found] <bug-16602-8968@http.gcc.gnu.org/bugzilla/>
2007-09-19  9:47 ` schwab at suse dot de
2007-09-19 11:46 ` bonzini at gnu dot org
2007-09-19 17:27 ` raeburn at raeburn dot org
2007-09-26 11:58 ` jozef dot behran at krs dot sk
2007-09-26 12:10 ` jsm28 at gcc dot gnu dot org
2007-09-26 12:33 ` jozef dot behran at krs dot sk
2007-09-26 16:40 ` pinskia at gcc dot gnu dot org
2010-03-12  3:49 ` ilatypov at infradead dot org
2010-03-15 19:47 ` ilatypov at infradead dot org
     [not found] <bug-16602-4@http.gcc.gnu.org/bugzilla/>
2014-02-13  1:22 ` sebunger44 at gmail dot com
2014-02-13  1:52 ` pinskia at gcc dot gnu.org
2014-02-26  1:53 ` pinskia at gcc dot gnu.org
2014-02-26  1:56 ` joseph at codesourcery dot com
2014-02-26  2:00 ` sebunger44 at gmail 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).