From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id C299E3858412 for ; Sat, 5 Feb 2022 12:26:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C299E3858412 Received: by mail-pf1-x429.google.com with SMTP id i186so7522008pfe.0 for ; Sat, 05 Feb 2022 04:26:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=RCE6rOW1BBhTy8M+tmdFvotAojUcbI0nzC95lOo2ILE=; b=t2vskD9I+CDh2fKun9baPFcjIJIjzmiNe7dYFu349BPze0arwWcKL+KYcJFwCweacl MQYOxV7t867I6WtOvyI9N2AU3PZsSkCDkryNFvGXuHP8vTc1ZEypGPvc0bJmMIaAia3g tLwx8odheRMlDcJkQdi2+wub3OBMs5fmx9ypgaL4Nl+dHMQQyoYP1pcPnr/Xfyu6mQ/N qLk4LI0ZEIS4EUcqIYe0ful4l3w36mx9UMyQioDLYsifmGA3TcWAodqjwD+AtzJPhNNW z0LFqgqx7GctVqN4ulVVmIP+bC7P6ETReciT0bLhNelksXdT6hJ8EjjoTPGSCN4ND4Wz Vo9A== X-Gm-Message-State: AOAM533P7exaQ+wTdDLALnb3uIo7xP7y6N1qWvEDfjCbQEPrBb2t6rLf zOkMTr2dwK05Kz5jrP07xZslJ5VhscSGDiOt7zVagD+vah4= X-Google-Smtp-Source: ABdhPJyACqudrz4SPgZ6FkbpNLgC8Byqh2yJCuSCH8EraAFbaok2jre99goaEHMRu41qbZdTdlHIBqgfiSrN8uspyHY= X-Received: by 2002:a05:6a00:2490:: with SMTP id c16mr7557256pfv.67.1644063981055; Sat, 05 Feb 2022 04:26:21 -0800 (PST) MIME-Version: 1.0 From: Krishna Narayanan Date: Sat, 5 Feb 2022 17:56:09 +0530 Message-ID: Subject: Doubts regarding the issue (Bug:93432). To: gcc-help X-Spam-Status: No, score=1.9 required=5.0 tests=BAYES_05, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_FONT_FACE_BAD, HTML_MESSAGE, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Feb 2022 12:26:24 -0000 Respected Sir/Madam, I have been working on this issue bug 93432 ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93432) and tried out few more permutations of the uninitialized variables in the test code. When I compile and run the test code the output is always some garbage value due to the returning of uninitialized variable as mentioned in the comments. 1.I tried removing the continue ,even then it does not give a warning for both clang and gcc.I have used -Wextra ,-Wall,-Wuninitialized,-Winit-self. This is the code: #include int test53(int y) { int z;int x; for ( x=0; x<10; x=x+1,y=y+1,z=z+1) { if (y<10) { z=z+1; } }return z; } int main() { printf("%d\n", test53(0)); printf("%d\n", test53(5)); printf("%d\n", test53(10)); return 0; } 2.Now I tried using another uninitialized variable a but did not introduce in the loop for an increment it throws warning for -Wall,-Wunintiialized and no warning for -Winit-self,-O2. #include int test53(int y) { int z;int x;int a; for ( x=0; x<10; x=x+1,y=y+1,z=z+1) { if (y<10) { z=z+1+a; } }return z; } int main() { printf("%d\n", test53(0)); printf("%d\n", test53(5)); printf("%d\n", test53(10)); return 0; } The warning shown is : *:* In function '*test53*': *:8:8:* *warning: *'*a*' may be used uninitialized [ *-Wmaybe-uninitialized*] 8 | *z=z+1+a*; | *~^~~~~~* *:3:19:* *note: *'*a*' was declared here 3 | int z;int x;int *a*; | *^* Compiler returned: 0 3.When I try using it in loop that is giving an increment 'a=a+1' in the for loop, for ( x=0; x<10; x=x+1,y=y+1,z=z+1,a=a+1) the warning thrown by -Wuninitialized is not shown, that is when a variable as soon as it is introduced in the for loop the warning suppresses. There is no warning in the third case. I am not sure but this means when we indulge a uninitialized variable to change its own value by using +,-,*,/ there is no warning but warning arises when directly use it in a task or function. Can you please check this? Hoping for your reply soon. Thanks and Regards, Krishna Narayanan.