public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/62037] cannot pass 'int **' as a 'int const* const*' parameter
2014-08-06 14:47 [Bug c/62037] New: cannot pass 'int **' as a 'int const* const*' parameter mrolnik at gmail dot com
@ 2014-08-06 14:47 ` mrolnik at gmail dot com
2014-08-06 15:00 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: mrolnik at gmail dot com @ 2014-08-06 14:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62037
--- Comment #1 from Michael Rolnik <mrolnik at gmail dot com> ---
Created attachment 33262
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33262&action=edit
compiler output
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/62037] New: cannot pass 'int **' as a 'int const* const*' parameter
@ 2014-08-06 14:47 mrolnik at gmail dot com
2014-08-06 14:47 ` [Bug c/62037] " mrolnik at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: mrolnik at gmail dot com @ 2014-08-06 14:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62037
Bug ID: 62037
Summary: cannot pass 'int **' as a 'int const* const*'
parameter
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: mrolnik at gmail dot com
Created attachment 33261
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33261&action=edit
.i file
when I pass 'int **' object as a function parameter declares as 'int const*
const*' I get a warning (see below)
Using built-in specs.
COLLECT_GCC=c:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32
--build=mingw32 --without-pic --enable-shared --enable-static --with-gnu-ld
--enable-lto --enable-libssp --disable-multilib
--enable-languages=c,c++,fortran,objc,obj-c++,ada --disable-sjlj-exceptions
--with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug
--enable-version-specific-runtime-libs
--with-gmp=/usr/src/pkg/gmp-5.1.2-1-mingw32-src/bld
--with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --with-mpfr=
--with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-libgomp
--enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/mingw
--disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-mtune=generic' '-march=pentiumpro'
c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/cc1.exe -E -quiet -v -iprefix
c:\mingw\bin\../lib/gcc/mingw32/4.8.1/ test.c -mtune=generic -march=pentiumpro
-fpch-preprocess -o test.i
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/include"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/../../../../include"
ignoring duplicate directory "/mingw/include"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/include-fixed"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.8.1/../../../../mingw32/include"
ignoring duplicate directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
c:\mingw\bin\../lib/gcc/mingw32/4.8.1/include
c:\mingw\bin\../lib/gcc/mingw32/4.8.1/../../../../include
c:\mingw\bin\../lib/gcc/mingw32/4.8.1/include-fixed
c:\mingw\bin\../lib/gcc/mingw32/4.8.1/../../../../mingw32/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-mtune=generic' '-march=pentiumpro'
c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/cc1.exe -fpreprocessed test.i -quiet
-dumpbase test.c -mtune=generic -march=pentiumpro -auxbase test -version -o
test.s
GNU C (GCC) version 4.8.1 (mingw32)
compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.2, MPC
version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (GCC) version 4.8.1 (mingw32)
compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.2, MPC
version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 767202a405449496e68a54c4eee91a28
test.c: In function 'main':
test.c:13:2: warning: passing argument 1 of 'foo' from incompatible pointer
type [enabled by default]
foo(&pA);
^
test.c:3:6: note: expected 'const int * const*' but argument is of type 'int
**'
void foo(const int * const* a)
^
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-mtune=generic' '-march=pentiumpro'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/as.exe -v -o
test.o test.s
GNU assembler version 2.23.2 (mingw32) using BFD version (GNU Binutils) 2.23.2
COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/;c:/mingw/bin/../libexec/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/
LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/4.8.1/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/;c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-mtune=generic' '-march=pentiumpro'
c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/collect2.exe -Bdynamic
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib/crt2.o
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/crtbegin.o
-Lc:/mingw/bin/../lib/gcc/mingw32/4.8.1 -Lc:/mingw/bin/../lib/gcc
-Lc:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/lib
-Lc:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../.. test.o -lmingw32 -lgcc
-lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32
-lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/crtend.o
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/62037] cannot pass 'int **' as a 'int const* const*' parameter
2014-08-06 14:47 [Bug c/62037] New: cannot pass 'int **' as a 'int const* const*' parameter mrolnik at gmail dot com
2014-08-06 14:47 ` [Bug c/62037] " mrolnik at gmail dot com
@ 2014-08-06 15:00 ` redi at gcc dot gnu.org
2014-08-06 15:08 ` mpolacek at gcc dot gnu.org
2014-08-06 15:11 ` mrolnik at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2014-08-06 15:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62037
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Firstly, a warning doesn't mean you cannot do it, you just get a warning.
Secondly, that's the correct behaviour, see
http://c-faq.com/ansi/constmismatch.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/62037] cannot pass 'int **' as a 'int const* const*' parameter
2014-08-06 14:47 [Bug c/62037] New: cannot pass 'int **' as a 'int const* const*' parameter mrolnik at gmail dot com
2014-08-06 14:47 ` [Bug c/62037] " mrolnik at gmail dot com
2014-08-06 15:00 ` redi at gcc dot gnu.org
@ 2014-08-06 15:08 ` mpolacek at gcc dot gnu.org
2014-08-06 15:11 ` mrolnik at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-08-06 15:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62037
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |mpolacek at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Yeah, I don't think there's anything to do. With latest GCC, you can suppress
this particular warning using -Wno-incompatible-pointer-types.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/62037] cannot pass 'int **' as a 'int const* const*' parameter
2014-08-06 14:47 [Bug c/62037] New: cannot pass 'int **' as a 'int const* const*' parameter mrolnik at gmail dot com
` (2 preceding siblings ...)
2014-08-06 15:08 ` mpolacek at gcc dot gnu.org
@ 2014-08-06 15:11 ` mrolnik at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: mrolnik at gmail dot com @ 2014-08-06 15:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62037
Michael Rolnik <mrolnik at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
--- Comment #4 from Michael Rolnik <mrolnik at gmail dot com> ---
it seems my assumption about const pointers to const data was wrong.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-08-06 15:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-06 14:47 [Bug c/62037] New: cannot pass 'int **' as a 'int const* const*' parameter mrolnik at gmail dot com
2014-08-06 14:47 ` [Bug c/62037] " mrolnik at gmail dot com
2014-08-06 15:00 ` redi at gcc dot gnu.org
2014-08-06 15:08 ` mpolacek at gcc dot gnu.org
2014-08-06 15:11 ` mrolnik 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).