Bug 781473

Summary: gcc compiler show false warning on correct code
Product: [Fedora] Fedora Reporter: Segey A. Murylev <SergeyMurylev>
Component: gcc4Assignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: SergeyMurylev
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-13 16:36:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
test source code none

Description Segey A. Murylev 2012-01-13 15:12:55 UTC
Description of problem:
gcc compiler show false warning on correct code
actually this source compiled by g++ compiler from same toolchain with same command line keys don't display this warning.

Version-Release number of selected component (if applicable):
gcc (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9)

How reproducible:
Compile source, attached to this bug with '-Wall' key.

Steps to Reproduce:
1. Compile source attached to this bug as listed below:
  
Actual results:
$ c99 -Wall test.c 
test.c: In function ‘main’:
test.c:8:5: warning: passing argument 1 of ‘foo’ from incompatible pointer type [enabled by default]
test.c:3:6: note: expected ‘const char * const*’ but argument is of type ‘char **’
$

Expected results:
$ c99 -Wall test.c 
$

Additional info:
$ c++ -Wall test.c 
$

Comment 1 Segey A. Murylev 2012-01-13 15:14:35 UTC
Created attachment 555082 [details]
test source code

Comment 2 Jakub Jelinek 2012-01-13 16:36:55 UTC
The warning is correct.  C and C++ are different languages, so it is not surprising that sometimes you get a warning or error in one of them and not the other one.