Barium x-rays may also be used to diagnose the cause of gastrointestinal bleeding. Liquid containing barium is either swallowed or inserted into the rectum for this test. The barium makes the digestive tract visible in the x-rays.