public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35233]  New: Unexpected error messages about invalid pointer conversions at end of array initialisation
@ 2008-02-17 13:47 Markus dot Elfring at web dot de
  2008-02-17 13:56 ` [Bug c++/35233] " Markus dot Elfring at web dot de
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Markus dot Elfring at web dot de @ 2008-02-17 13:47 UTC (permalink / raw)
  To: gcc-bugs

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

I compiled the current software
"http://sipp.svn.sourceforge.net/viewvc/sipp/sipp/trunk/sipp.cpp?revision=424&view=markup"
on my openSUSE 10.3 system. I would like to get rid of warnings like "Warnung:
veraltete Konvertierung von Zeichenkettenkonstante in »char*«" (deprecated
conversion of string constant). I tried also to fix some other details for
const-correctness in the source code.
Now I get the following error messages about invalid conversions for pointers
at the end of the initialisation for the array "options_table".

g++ -D__LINUX -pthread -DSVN_VERSION="\"svn424M\"" -save-temps -I.
-I/usr/include/openssl -c -o sipp.o sipp.cpp
sipp.cpp:301: Fehler: ungültige Umwandlung von »const void*« in »void*«
sipp.cpp:301: Fehler: ungültige Umwandlung von »const void*« in »void*«
make[1]: *** [sipp.o] Fehler 1
make[1]: Leaving directory `/home/elfring/Projekte/SIPp/1680134/trunk'

I did not change the field values and data type for this global variable
"options_table". I would normally expect that my updates in other source file
parts will not affect this specific area.


-- 
           Summary: Unexpected error messages about invalid pointer
                    conversions at end of array initialisation
           Product: gcc
           Version: 4.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Markus dot Elfring at web dot de
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug c++/35233] Unexpected error messages about invalid pointer conversions at end of array initialisation
  2008-02-17 13:47 [Bug c++/35233] New: Unexpected error messages about invalid pointer conversions at end of array initialisation Markus dot Elfring at web dot de
@ 2008-02-17 13:56 ` Markus dot Elfring at web dot de
  2008-02-17 14:03 ` Markus dot Elfring at web dot de
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Markus dot Elfring at web dot de @ 2008-02-17 13:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from Markus dot Elfring at web dot de  2008-02-17 13:55 -------
Created an attachment (id=15175)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15175&action=view)
preprocessed source file

I can circumvent the mentioned error messages if I partly deactivate the array
initialisation for some elements by the preprocessor instruction "#if 0".


-- 


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


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

* [Bug c++/35233] Unexpected error messages about invalid pointer conversions at end of array initialisation
  2008-02-17 13:47 [Bug c++/35233] New: Unexpected error messages about invalid pointer conversions at end of array initialisation Markus dot Elfring at web dot de
  2008-02-17 13:56 ` [Bug c++/35233] " Markus dot Elfring at web dot de
@ 2008-02-17 14:03 ` Markus dot Elfring at web dot de
  2008-02-17 14:27 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Markus dot Elfring at web dot de @ 2008-02-17 14:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from Markus dot Elfring at web dot de  2008-02-17 14:03 -------
Created an attachment (id=15176)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15176&action=view)
update candidates

I am surprised how the global variable "options_table" is affected by other
changes because it is untouched in comparison to the previous version.
https://sourceforge.net/tracker/?func=detail&atid=637567&aid=1680134&group_id=104305


-- 


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


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

* [Bug c++/35233] Unexpected error messages about invalid pointer conversions at end of array initialisation
  2008-02-17 13:47 [Bug c++/35233] New: Unexpected error messages about invalid pointer conversions at end of array initialisation Markus dot Elfring at web dot de
  2008-02-17 13:56 ` [Bug c++/35233] " Markus dot Elfring at web dot de
  2008-02-17 14:03 ` Markus dot Elfring at web dot de
@ 2008-02-17 14:27 ` rguenth at gcc dot gnu dot org
  2008-02-17 15:52 ` Markus dot Elfring at web dot de
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-02-17 14:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-02-17 14:26 -------
The problem is here:

sipp.cpp(137): error: a value of type "const char *const *" cannot be used to
initialize an entity of type "void *"
   {"cid_str", "Call ID string (default %u-%p@%s).  %u=call_number,
%s=ip_address, %p=process_number, %%=% (in any order).", 5, &call_id_string,
1},
                                                                               
                                                ^

sipp.cpp(247): error: a value of type "const char *const *" cannot be used to
initialize an entity of type "void *"
   {"stat_delimiter", "Set the delimiter for the statistics file", 5,
&stat_delimiter, 1},

just add casts to (void *) after taking the addresses.

Also please use the gcc-help@ list for such questions, not bugzilla.

Thanks.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/35233] Unexpected error messages about invalid pointer conversions at end of array initialisation
  2008-02-17 13:47 [Bug c++/35233] New: Unexpected error messages about invalid pointer conversions at end of array initialisation Markus dot Elfring at web dot de
                   ` (2 preceding siblings ...)
  2008-02-17 14:27 ` rguenth at gcc dot gnu dot org
@ 2008-02-17 15:52 ` Markus dot Elfring at web dot de
  2008-02-17 15:56 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Markus dot Elfring at web dot de @ 2008-02-17 15:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from Markus dot Elfring at web dot de  2008-02-17 15:52 -------
(In reply to comment #3)
> The problem is here:
> sipp.cpp(137): error: a value of type "const char *const *" cannot be used to
> initialize an entity of type "void *"
>    {"cid_str", "Call ID string (default %u-%p@%s).  %u=call_number,
> %s=ip_address, %p=process_number, %%=% (in any order).", 5, &call_id_string,
> 1},
>                                                                                
>                                                 ^

Thanks for your suggestion.


> sipp.cpp(247): error: a value of type "const char *const *" cannot be used to
> initialize an entity of type "void *"

How did you get this error message? It is different from mine.

Each array element is initialised by five values that were not flagged with
errors before my source code refactoring. Well, I'm sorry - The initialisation
list was too long for me to remember that I updated the data type for two other
global variables that were referenced from the included source file "sipp.hpp".
The message did not point me to my error directly. I suggest to improve the
wording from "an entity" to "entity 'data'" in my use case.
struct sipp_option {
        const char *option;
        const char *help;
        int type;
        void *data;
        int pass;
};


> just add casts to (void *) after taking the addresses.

The specification "void const* data;" would be another design option. It might
not be clear yet which way will be preferred for the concrete application.


-- 


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


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

* [Bug c++/35233] Unexpected error messages about invalid pointer conversions at end of array initialisation
  2008-02-17 13:47 [Bug c++/35233] New: Unexpected error messages about invalid pointer conversions at end of array initialisation Markus dot Elfring at web dot de
                   ` (3 preceding siblings ...)
  2008-02-17 15:52 ` Markus dot Elfring at web dot de
@ 2008-02-17 15:56 ` rguenth at gcc dot gnu dot org
  2008-02-17 16:11 ` [Bug c++/35233] Feature request: precise error messages about invalid pointer conversions during " Markus dot Elfring at web dot de
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-02-17 15:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-02-17 15:55 -------
I used the Intel compiler to point me to the actual error.


-- 


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


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

* [Bug c++/35233] Feature request: precise error messages about invalid pointer conversions during array initialisation
  2008-02-17 13:47 [Bug c++/35233] New: Unexpected error messages about invalid pointer conversions at end of array initialisation Markus dot Elfring at web dot de
                   ` (4 preceding siblings ...)
  2008-02-17 15:56 ` rguenth at gcc dot gnu dot org
@ 2008-02-17 16:11 ` Markus dot Elfring at web dot de
  2008-02-17 16:42 ` rguenth at gcc dot gnu dot org
  2008-02-17 17:17 ` Markus dot Elfring at web dot de
  7 siblings, 0 replies; 9+ messages in thread
From: Markus dot Elfring at web dot de @ 2008-02-17 16:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from Markus dot Elfring at web dot de  2008-02-17 16:11 -------
It was hard for me to spot the updated variables "stat_delimiter" and
"call_id_string" as the error reasons.

It would be nice if the GCC implementation will be even more precise than the
check with the Intel compiler. How do you think about better error indicators?


-- 

Markus dot Elfring at web dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |
            Summary|Unexpected error messages   |Feature request: precise
                   |about invalid pointer       |error messages about invalid
                   |conversions at end of array |pointer conversions during
                   |initialisation              |array initialisation


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


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

* [Bug c++/35233] Feature request: precise error messages about invalid pointer conversions during array initialisation
  2008-02-17 13:47 [Bug c++/35233] New: Unexpected error messages about invalid pointer conversions at end of array initialisation Markus dot Elfring at web dot de
                   ` (5 preceding siblings ...)
  2008-02-17 16:11 ` [Bug c++/35233] Feature request: precise error messages about invalid pointer conversions during " Markus dot Elfring at web dot de
@ 2008-02-17 16:42 ` rguenth at gcc dot gnu dot org
  2008-02-17 17:17 ` Markus dot Elfring at web dot de
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-02-17 16:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2008-02-17 16:41 -------
Well, certainly.  We possibly already have an enhancement request for this.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


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

* [Bug c++/35233] Feature request: precise error messages about invalid pointer conversions during array initialisation
  2008-02-17 13:47 [Bug c++/35233] New: Unexpected error messages about invalid pointer conversions at end of array initialisation Markus dot Elfring at web dot de
                   ` (6 preceding siblings ...)
  2008-02-17 16:42 ` rguenth at gcc dot gnu dot org
@ 2008-02-17 17:17 ` Markus dot Elfring at web dot de
  7 siblings, 0 replies; 9+ messages in thread
From: Markus dot Elfring at web dot de @ 2008-02-17 17:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from Markus dot Elfring at web dot de  2008-02-17 17:17 -------
I am curious on improvements for unambiguous error reporting with variable and
member names.


-- 

Markus dot Elfring at web dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic


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


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

end of thread, other threads:[~2008-02-17 17:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-17 13:47 [Bug c++/35233] New: Unexpected error messages about invalid pointer conversions at end of array initialisation Markus dot Elfring at web dot de
2008-02-17 13:56 ` [Bug c++/35233] " Markus dot Elfring at web dot de
2008-02-17 14:03 ` Markus dot Elfring at web dot de
2008-02-17 14:27 ` rguenth at gcc dot gnu dot org
2008-02-17 15:52 ` Markus dot Elfring at web dot de
2008-02-17 15:56 ` rguenth at gcc dot gnu dot org
2008-02-17 16:11 ` [Bug c++/35233] Feature request: precise error messages about invalid pointer conversions during " Markus dot Elfring at web dot de
2008-02-17 16:42 ` rguenth at gcc dot gnu dot org
2008-02-17 17:17 ` Markus dot Elfring at web dot de

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