Lists: | pgsql-hackers |
---|
From: | Karol Trzcionka <karlikt(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | compiler warning in UtfToLocal and LocalToUtf (conv.c) |
Date: | 2013-07-19 00:04:42 |
Message-ID: | 51E8829A.5020507@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hello,
in the current master head (4cbe3ac3e86790d05c569de4585e5075a62a9b41),
I've noticed the compiler warnings in src/backend/utils/mb/conv.c
conv.c: In function ‘UtfToLocal’:
conv.c:252:23: error: ‘iutf’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
...
conv.c: In function ‘LocalToUtf’:
conv.c:301:23: error: ‘iiso’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
...
The compiler doesn't know that the 'l' may varies between 1 and 4. Hot
fix may be:
1. preinitialize it
2. delete last if statement (change else-if to else)
3. change it to switch-case and set default behaviour
Regards,
Karol
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Karol Trzcionka <karlikt(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: compiler warning in UtfToLocal and LocalToUtf (conv.c) |
Date: | 2013-07-19 00:42:06 |
Message-ID: | 27829.1374194526@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Karol Trzcionka <karlikt(at)gmail(dot)com> writes:
> in the current master head (4cbe3ac3e86790d05c569de4585e5075a62a9b41),
> I've noticed the compiler warnings in src/backend/utils/mb/conv.c
Hm, what compiler version are you using? I've never seen such a warning
(and that code hasn't changed in some time).
I agree the code could stand to be fixed, but I'm just curious as to
why this is only being seen now.
regards, tom lane
From: | Karol Trzcionka <karlikt(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: compiler warning in UtfToLocal and LocalToUtf (conv.c) |
Date: | 2013-07-19 00:48:56 |
Message-ID: | 51E88CF8.1000903@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
W dniu 19.07.2013 02:42, Tom Lane pisze:
> Hm, what compiler version are you using? I've never seen such a
> warning (and that code hasn't changed in some time).
gcc version 4.8.1 20130612 (Red Hat 4.8.1-2) (GCC)
Regards,
Karol