[compiler-rt] r202008 - tsan: fix compiler warning

David Blaikie dblaikie at gmail.com
Mon Feb 24 09:43:30 PST 2014


On Mon, Feb 24, 2014 at 12:19 AM, Dmitry Vyukov <dvyukov at google.com> wrote:

> Author: dvyukov
> Date: Mon Feb 24 02:19:53 2014
> New Revision: 202008
>
> URL: http://llvm.org/viewvc/llvm-project?rev=202008&view=rev
> Log:
> tsan: fix compiler warning
> error: address of array 'tctx->name' will always evaluate to 'true'
>
>
> Modified:
>     compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=202008&r1=202007&r2=202008&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Mon Feb 24 02:19:53
> 2014
> @@ -212,7 +212,7 @@ void ScopedReport::AddThread(const Threa
>    rt->id = tctx->tid;
>    rt->pid = tctx->os_id;
>    rt->running = (tctx->status == ThreadStatusRunning);
> -  rt->name = tctx->name ? internal_strdup(tctx->name) : 0;
> +  rt->name = internal_strdup(tctx->name);
>

Why do you need to call strdup at all? This is char[] to char[]
assignment... shouldn't that require a strcpy? (how does this code, or even
the previous code, compile at all?)


>    rt->parent_tid = tctx->parent_tid;
>    rt->stack = 0;
>  #ifdef TSAN_GO
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140224/1cbbec1e/attachment.html>


More information about the llvm-commits mailing list