This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/33988] New: Warning when converting between C compatible pointers


The RM95 B.3.1 contains: "The type chars_ptr is C-compatible and
corresponds to the use of C's ``char *'' for a pointer to the first char
in a char array terminated by nul.".

Doesn't it imply that it has a C convention, or at least that it can be
converted to an access type with convention C without warranting a
warning? When compiling the following test with GCC trunk and -Wall, I get:

t.ads:10:04: warning: conversion between pointers with different conventions

(I know the following code looks strange, but it is a specially built
test case following a more complex case found in AdaSockets)

--
with Ada.Unchecked_Conversion;
with Interfaces.C.Strings;

package T is

   type P is access Integer;
   pragma Convention (C, P);

   function Convert is
      new Ada.Unchecked_Conversion (Interfaces.C.Strings.chars_ptr, P);

end T;


-- 
           Summary: Warning when converting between C compatible pointers
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sam at rfc1149 dot net
  GCC host triplet: i386-linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]