[petsc-users] Many warning in my code

Matthew Knepley knepley at gmail.com
Tue Jul 16 09:12:50 CDT 2024


We cannot see your code. The warning says that you give a value to a
variable, but then never use it. We cannot tell if that is true without
looking at the code.

  Thanks,

     Matt

On Tue, Jul 16, 2024 at 9:54 AM Ivan Luthfi <ivanluthfi5 at gmail.com> wrote:

> Hello guys, I am still trying to compile my old multigrid code. But i get
> so many warning, one of those warning is like this: MsFEM_poisson2D_DMDA.
> c: In function ‘int main(int, char**)’: MsFEM_poisson2D_DMDA. c: 185: 48:
> warning: variable ‘finest’
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> This message came from outside your organization.
>
> ZjQcmQRYFpfptBannerEnd
> Hello guys,
> I am still trying to compile my old multigrid code. But i get so many
> warning, one of those warning is like this:
> MsFEM_poisson2D_DMDA.c: In function ‘int main(int, char**)’:
> MsFEM_poisson2D_DMDA.c:185:48: warning: variable ‘finest’ set but not used
> [-Wunused-but-set-variable]
>   185 |                         PetscInt mg_level = 2, finest;
>       |                                                ^~~~~~
> MsFEM_poisson2D_DMDA.c:56:44: warning: variable ‘pi’ set but not used
> [-Wunused-but-set-variable]
>    56 |         PetscScalar             a,b,c,d,dt,pi;
>       |                                            ^~
> MsFEM_poisson2D_DMDA.c:57:35: warning: variable ‘Lx’ set but not used
> [-Wunused-but-set-variable]
>    57 |         PetscInt                M,Lx,Ly,Nx,Ny,Mx,My;
>       |                                   ^~
> MsFEM_poisson2D_DMDA.c:57:38: warning: variable ‘Ly’ set but not used
> [-Wunused-but-set-variable]
>    57 |         PetscInt                M,Lx,Ly,Nx,Ny,Mx,My;
>       |                                      ^~
> MsFEM_poisson2D_DMDA.c:58:33: warning: variable ‘hx’ set but not used
> [-Wunused-but-set-variable]
>    58 |         PetscScalar             hx,hy,Hx,Hy;
>       |                                 ^~
> MsFEM_poisson2D_DMDA.c:58:36: warning: variable ‘hy’ set but not used
> [-Wunused-but-set-variable]
>    58 |         PetscScalar             hx,hy,Hx,Hy;
>       |                                    ^~
> MsFEM_poisson2D_DMDA.c:58:39: warning: variable ‘Hx’ set but not used
> [-Wunused-but-set-variable]
>    58 |         PetscScalar             hx,hy,Hx,Hy;
>       |                                       ^~
> MsFEM_poisson2D_DMDA.c:58:42: warning: variable ‘Hy’ set but not used
> [-Wunused-but-set-variable]
>    58 |         PetscScalar             hx,hy,Hx,Hy;
>       |                                          ^~
> MsFEM_poisson2D_DMDA.c:60:58: warning: variable ‘Nondimensionalization’
> set but not used [-Wunused-but-set-variable]
>    60 |         PetscInt
>  Compute_finegridsolution,Nondimensionalization;
>       |
>  ^~~~~~~~~~~~~~~~~~~~~
> MsFEM_poisson2D_DMDA.c:283:54: warning: ‘%d’ directive writing between 1
> and 11 bytes into a region of size between 0 and 99
>
>
> Can you guys help me to fix or solve this warning in order to get the code
> run smoothly. Please help
>
>
> --
> Best regards,
>
> Ivan Luthfi Ihwani
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!awUD7DouA4Cjqw1gYsc2V7I8PVc9ojQXaCMFCcPwBUMEXEYkc9N6wUcfv_EYtLHhF_rlH_rNmpGvlGD9ZfYP$  <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!awUD7DouA4Cjqw1gYsc2V7I8PVc9ojQXaCMFCcPwBUMEXEYkc9N6wUcfv_EYtLHhF_rlH_rNmpGvlGao1sti$ >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240716/103c20f0/attachment-0001.html>


More information about the petsc-users mailing list